X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=vbawhWwLIPldAWWnfwTvtI+jfGmbPGRAN3s17B/hHwG2uw4qYBIK6 SvB5ngorXWsMSv5ld9LwSE0nFue4nUJMqry2SabBTr6uxXH5A4bUcW/6P393f2f6 jee5QHb3hnhfvRZ2BVeXb7oniiCm0lNfqCXB421fg1BW8q4xiXOQR0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=j516x1aEx5MK5K/+U9zQpEFu7C0=; b=Lov0RvsA0dZL/vL5aPRHc3bMkjMU 4AG3scy6hV4R/Bd68+6+un+GHyRYftccPs+MzuzEf+Ku70b364Pab4RlG262j/gK wC3JcA9TL9oxJQo0QVI6Hf3oY4jxF3GAgqtQ9hMLzBrgXGt99pnz/6PyUeBPGA6T mz5E9GSe3c2Sii4= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1 Date: Mon, 3 Jun 2013 12:01:02 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: pthread_join() problem Message-ID: <20130603100102.GA14318@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <51ABC0BE DOT 5080408 AT tiscali DOT co DOT uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <51ABC0BE.5080408@tiscali.co.uk> User-Agent: Mutt/1.5.21 (2010-09-15) On Jun 2 23:01, David Stacey wrote: > I'm trying to get Poco[1] working under Cygwin, and have hit a > problem with the way it manages its threads. A short example > (attached) shows what's going on. > > Poco creates a global object that is used for managing various > threads. In the destructor, the class calls pthread_join() to wait > for the threads to finish. This works in Fedora (and presumably > other Linux variants), but under Cygwin this call never returns. > Note that the object is global, and so pthread_join() is being > called after main() has returned and the global variables are being > mopped up. > > In the attached example, the problem only exists if the > 'thread_container' object is global. When run in this way, > pthread_join() never returns and the programme locks up. If > 'thread_container' is moved local to main() then the programme works > correctly. Sadly, I can't make such a trivial fix to the Poco code, > which rather relies on this object being global. > > The attached example (and indeed Poco) runs fine under Fedora 18 > x64, but locks up on Cygwin (32-bit; haven't tried 64-bit). Problem > exists with a vanilla cygwin-1.7.18-1 and the most recent snapshot > (2013-06-02). Thanks for the simple testcase! I tracked this down to a problem in the process exit handling which disallowed pthreads to exit when process exit was in progress (and running the global destructors is part of the process exit). I fixed that in CVS. I'm just uploading a 2013-06-03 snapshot to http://cygwin.com/snapshots/ as well as generating a 1.7.9-10 cygwin package for the 64 bit test distro. Please give either one of them a try, especially with poco. Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple