This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
Re: calling mutex_lock() twice from one thread
- From: Will Bryant <will dot bryant at ecosm dot com>
- To: Bastian Voigt <bastian at voigt dot in-berlin dot de>, pthreads-win32 at sources dot redhat dot com
- Date: Wed, 17 Nov 2004 19:11:38 +1300
- Subject: Re: calling mutex_lock() twice from one thread
- References: <419888D2.3060502@voigt.in-berlin.de>
Bastian Voigt wrote:
The main thread loads some configuration, then starts some worker
threads. After the worker threads are running I want the main thread
to sleep until a signal (Ctrl-C) arrives. Will it work better when
using semaphores?
Yes, aside from the fact that you want non-recursive locks, semaphores
are the _only_ synchronization primitive that can be used from inside
signal handlers. Note that condition variables most definitely cannot
be signalled from inside a signal handler - that will break - badly - on
most unix platforms.
--
Will Bryant
Systems Architect, eCOSM.
Phone +64 3 365 4176 | Mobile +64 21 655 443
http://www.ecosm.com/