In brief, does anyone have multithreaded code that catches all signals of a process working?

Im trying to get a thread to handle all signals sent by all threads of the same process but to no avail. The only way I can get the thread handler to work is to set a global signal handler which then sends the signal to the signal handler thread which then sets a global signal variable which other threads can look at.

In other words, blocking all signals in a main process, starting a thread to sigwait on all blocked signals, performing a zero divide in main thread doesn't work, the program bombs.

Conversely, do the same above except declaring a global signal handler, which then catches the signal, sends it to the sigwait thread does work but with timing issues using mutexes(that is by the time the sigwait thread trys to lock the mutex the main code body has already ripped through). I get it to work by using a sleep func.

Anyway, the IBM site samples tend to assume a main thread controls everything and you actually know the signal catching.
Any other ideas?


Want a degree but can't afford to quit? Top school degrees online - in as fast as 1 year

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.