Statically initialising pthread attributes in dynamic dlls.

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Wed Feb 24 21:45:00 GMT 2010


On Wed, Feb 24, 2010 at 05:38:09PM +0000, Andrew West wrote:
>On 24/02/2010 05:26, Dave Korn wrote:
>>    Yeh, that works nicely.  Here's what I tested, along with a couple of extra
>> test cases I used to check whether exception handling was still working before
>> and after the dlopen call.  With the current state of HEAD, the first one
>> works (by which I mean "prints 'sig 11' forever" and the second one fails (by
>> which I means reaches some sort of exit without hitting the signal handler at
>> all).  With the attached diff, they both work (as does the original unmodified
>> testcase).
>>
>>    This is just a brain dump because I'm off to bed now, hence no change log,
>> and there's still commented-out stuff and inadequate commenting, but I figured
>>   I may as well let everyone know what I found out.  'night all!
>>
>>    
>
>I've tried out the latest snapshots with the code that I originally 
>found this bug with and it fixed the problem of
>being able to successfully call dlopen, but I seemed to run into what I 
>think was a similar problem when
>I called dlclose.
>
>Unfortunately I can't seem to create a simple test case demonstrating 
>this. If LoadLibrary could possibly remove
>the cygwin exception_handler isn't it possible that FreeLibrary could as 
>well?
>
>I adding the line;
>
>  _my_tls.init_exception_handler (_cygtls::handle_exceptions);
>
>To 'cygwin_detach_dll' before the 'dlls.detach' call and this seemed to 
>fix the problem, but I'm not entirely sure of
>what the reprocusions of this might be.

Hmm.  That would presumably cause the behavior that Dave Korn noted of
removing the handler after FreeLibrary returns.  So you'd have to put it
there and in dlclose.  I'll upload a new snapshot with that fix soon.

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



More information about the Cygwin mailing list