This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Calling sem_wait() in DllMain( DLL_THREAD_DETACH) crashes
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 15 Mar 2011 15:07:33 -0400
- Subject: Re: Calling sem_wait() in DllMain( DLL_THREAD_DETACH) crashes
- References: <4D7FB133.7030301@dronecode.org.uk>
- Reply-to: cygwin at cygwin dot com
On Tue, Mar 15, 2011 at 06:34:27PM +0000, Jon TURNEY wrote:
>
>I've come across a problem whilst trying to run the twisted test suite, where
>some tests just cause python to segfault. It seems to be the same issue with
>libcrypto as reported in [2],[3]
>
>A small test case is attached to [2] as cygwin_crash.zip, referred to in
>msg76086, which shows that manipulating a semaphore in
>DllMain(DLL_THREAD_DETACH) causes a crash.
>
>There is a patch for openssl attached to [1] which makes sense to me. Surely
>the cleanup ERR_remove_state() does should be requested using
>pthread_cleanup_push() rather using DllMain(DLL_THREAD_DETACH)? But that
>doesn't seem to be done for any other POSIX target. The documentation of
>ERR_remove_state() gives me the impression that it expects the application to
>arrange for that to happen, so perhaps it's just trying too hard to be
>helpful here?
>
>I suppose the alternative interpretation is that you are supposed to be able
>to call anything you like from DllMain(DLL_THREAD_DETACH), then this is a
>cygwin bug. But I can't see how that could be made work as pthread::exit() has
>to delete the cygwin thread object before ExitThread() is called, as there's
>no thread to do it in afterwards :-)
Actually you aren't supposed to be able to call anything you like here and
it isn't clear why a POSIX/UNIX/Linux program would be relying on DllMain.
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