From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25808 invoked by alias); 15 Nov 2004 10:47:10 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 24175 invoked from network); 15 Nov 2004 10:45:39 -0000 Received: from unknown (HELO mail.informatik.hu-berlin.de) (141.20.20.50) by sourceware.org with SMTP; 15 Nov 2004 10:45:39 -0000 Received: from [141.20.27.40] (rosmarin [141.20.27.40]) (authenticated bits=0) by mail.informatik.hu-berlin.de (8.12.10/8.12.10/INF-2.0-MA-SOLARIS-2.8) with ESMTP id iAFAjcBn027657 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 15 Nov 2004 11:45:38 +0100 (MET) Message-ID: <419888D2.3060502@voigt.in-berlin.de> Date: Mon, 15 Nov 2004 10:47:00 -0000 From: Bastian Voigt User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) MIME-Version: 1.0 To: pthreads-win32@sources.redhat.com Subject: calling mutex_lock() twice from one thread Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004/txt/msg00142.txt.bz2 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