[Pdx-pm] Q about ithreads && signals

Joshua Hoblitt jhoblitt at ifa.hawaii.edu
Sun Nov 17 14:13:27 CST 2002

> In C under the current Linux implementation, threads and signals are weird
> and not POSIX compliant.

I'm under solaris but the behavior is about the same.

> I haven't had the chance to use ithreads yet, but in C, something as
> "simple" as SIGALARM may not even go to the right thread.

I figured this out late last night... this is exactly whats going on.  It seems the SIG-ALARM is going to the wrong thread.

I also discovered that LWP is not thread safe :)  You seem to be ok if you spawn threads before doing anything with LWP.  However if you make a useragent/query and then spawn threads you get a seg fault.

> Rather than SIGALARM, use the queuing code that the new threading provides.
> That'll probably be closer to what you want if I've understood what you
> are trying to do...

The idea is to have a query to this web-server happen every 10 seconds (10 seconds from query start to query start).  I can't think of any clean way to do that without signals. (could burn up alot of cpu power watching the clock I guess)

> Believe the manual when it talks about threads  and signals!

I do :)



More information about the Pdx-pm-list mailing list