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: Nicolas EDEL <nedel at telisma dot com>
- To: Bastian Voigt <bastian at voigt dot in-berlin dot de>
- Cc: pthreads-win32 at sources dot redhat dot com
- Date: Mon, 15 Nov 2004 12:09:16 +0100
- Subject: Re: calling mutex_lock() twice from one thread
- Organization: Telisma
- References: <419888D2.3060502@voigt.in-berlin.de>
- Reply-to: nedel at telisma dot com
Bastian Voigt wrote:
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
hi,
maybe you should have a look at the pthread_cond_t doc & usage.
regards
--N