This is the mail archive of the cygwin-developers@cygwin.com 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: gcc static constructor multi-threading flaw


On Fri, Feb 14, 2003 at 10:09:44AM -0500, Joe Buehler wrote:
>Would you accept patches to gcc / cygwin to add locking to
>function-private static object constuction?
>
>Gcc generates calls to atexit() when entering a function that has a
>private static object.  It does this to schedule a call to the
>destructor at program exit time.
>
>The atexit() function is not thread-safe, however.  I posted an
>explanation to the newlib list, but looking at the newlib code, it
>appears that newlib is not really set up for locking, so a fix is
>probably not going to be forthcoming from there.
>
>One possible fix is to have gcc call a wrapper function that performs
>locking and then calls atexit().  I suppose another way to do it
>without touching gcc is #define manipulation to replace atexit() with a
>Cygwin wrapper.

Since neither gcc nor newlib have responded to this problem, I've
added a wrapper in cygwin.  It will be in 1.3.21.

cgf


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