This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
calling mutex_lock() twice from one thread
- From: Bastian Voigt <bastian at voigt dot in-berlin dot de>
- To: pthreads-win32 at sources dot redhat dot com
- Date: Mon, 15 Nov 2004 11:45:38 +0100
- Subject: calling mutex_lock() twice from one thread
Dear list,
according to the documentation pthread_mutex_lock() assigns the mutex to
the calling thread, and if a different thread calls it again it will be
blocked.
In my scenario I want one thread to block itself, to be waked up later
by a signal handler. This does not work by simply calling mutex_lock()
twice, it does not block.
What can you recommend to achieve this? To be more concrete, I do the
following:
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?
Thanks for any hints!
Bastian Voigt