Statically initialising pthread attributes in dynamic dlls.

Corinna Vinschen
Thu Feb 25 14:21:00 GMT 2010

On Feb 25 13:31, Dave Korn wrote:
> On 24/02/2010 21:44, Christopher Faylor wrote:
> > 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.  
>   The temporary handler in dll_dllcrt0_1 approach seems an awful lot simpler
> and more reliable to me than all this tedious mucking about in hyperspace...
> erm, I mean all this tedious unlinking and relinking the chain and hoping
> nothing bad happens during the window when we have no handler installed at
> all.  Why don't we just fix it this way instead?

Did you test it on Windows Server 2008?  I wrote this already in a
private email to cgf.  The really serious problem which lead to the
changes in the SEH handling was that in the original code (which worked
more or less flawlessly for ages) the exception handler chain was
changed to an endless loop, so that the replacement SEH handler for
the Cygwin handler became... the Cygwin handler.

However, this stopped working with Server 2008.  The code in Windows
2008 to check for the integrity of the SEH chain detected that and
restored the chain to the default of calling just the Windows default
exception handler.

The bottom line of this is, AFAICS, that changes to the SEH chain
handling in Cygwin should always be tested with Server 2008.  Way
back I asked in the Microsoft NG m.p.w.p.kernel about this problem
and it turned out that the integrity checking is not built into the
desktop OSes like Vista or W7.

Btw., if you don't have a Server 2008 machine, just install from here:

Works fine as a VM.  Even my Server 2008 domain controller is running in
a VM.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list