This is the mail archive of the pthreads-win32@sources.redhat.com mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]