This is the mail archive of the cygwin mailing list for the Cygwin 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]

Re: pthread_join() problem


On Mon, Jun 03, 2013 at 12:01:02PM +0200, Corinna Vinschen wrote:
>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.

I've reworked this change since Corinna's fix was to what should have
been obsolete code.  A new snapshot should be uploaded soon.

Could you confirm that things still work as expected?

cgf

--
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


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