[omniORB] signals, threads, and C++ exceptions

Andrey Koubychev email@vtc.ru
Wed Jul 24 16:00:05 2002


Hello Alexy,

Monday, July 22, 2002, 10:38:58 PM, you wrote:

AK> The pthread book recommends to dedicate a thread to signal
AK> handling, and mask out the signals on all other threads.
AK> However, how can we do it with MICO's internal threads?

Exactly the same question I've asked myself this morning and solved it
to afternoon. Although you write that you use MICO, I will assume that
you use OmniORB , because you write to omniorb list.
I did it this way and it works like i expected it to be:

1. masked TERM and HUP signal
2. Initialized omniorb library, created some program spefic threads,
that dont need to react on HUP and TERM.
3. Unmasked preiously masked signals.
4. Set HUP and TERM handlers to corresponding handlers.
5. Lock some global omnimutex
6  try to lock it second time. at this point main thread suspended
because omnimutex is not recursive.
5. In HUP and TERM handlers I set global var reason, unlock
omnimutex and exit signal handler. We are not allowed to do too much
there.
7. Suspended main thread resumes, check the reason , if it was HUP ,
reread configuration and go to 6. If it was TERM then do orb->destroy()

thats all , I hope it helps, If someone knows better way, let me know
:)

-- 
Best regards,
 Andrey                            mailto:email@vtc.ru