sigwait in multi-threaded application

From: KV Pavuram
Date: Tue Jul 19 2005 - 09:52:18 EST


Hi,

Are there any caveats of sigwait (on RT signals) in
multithreaded application?

As suggested in the man page, i call

# define SIG35 35
# define SIG36 36

sigaddset (&set, SIG36) ;
pthread_sigmask (SIG_BLOCK, &set, NULL);

at the beginning of the program (in main) before I
create any threads.

Then i register a signal handler for SIG35. The signal
handler i call sigwait for SIG36 as

sigaddset (&set, SIG36) ;
pthread_sigmask (SIG_BLOCK, &set, NULL) ;
sigwait (&set, &signum) ;
if (signum == SIG_TASKRESUME)
{
printf ("Task is received SIG36\n") ;
}

Is this usage right? I see that some times if run
strace on the particular thread that is currently in
sigwait and then kill strace with Ctrl+C, the threads
starts hogging CPU? Why should Ctrl+C wake up sigwait
on SIG36??

Am I missing something? (Linux 9, 2.4 kernel)

Regards,
Pav.




__________________________________________________________
How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/