[omniORB] signals and mutex's
Matthew Berry
mberry@mweb.co.za
Fri, 02 Mar 2001 10:29:32 +0200
I read somewhere that a pthread mutex should not be used in a signal handler
as it may result in deadlock.
The code I have implemented is listed below. Is this a problem?
....
void shutDownHandler(int signal)
{
static bool signalled = false;
static omni_mutex mutex;
omni_mutex_lock lock(mutex)
if (!signalled)
{
shut_down_condition.signal();
signalled = true;
}
}
....
int main()
{
...
boa->impl_is_ready(0, 1); // do not block
signal(SIGINT, shutDownHandler);
shut_down_condition.wait();
shut_down_condition.unlock();
server->_dispose();
boa->impl_shutdown();
...
}