SiegeLord / DAllegro5

D binding to the Allegro5 game development library
Other
42 stars 15 forks source link

Run thread-local static constructors and destructors on Mac #35

Closed emlai closed 8 years ago

emlai commented 8 years ago

From the documentation on thread_attachThis:

NOTE: This routine does not run thread-local static constructors when called. If full functionality as a D thread is desired, the following function must be called after thread_attachThis:

extern (C) void rt_moduleTlsCtor();

thread_detachThis has a similar note about calling rt_moduleTlsDtor after thread_detachThis.

This prevents bugs like the following: SimonN/LixD#121

Note: I don't know whether the same should or can be done for the D v1 version with Thread.thread_attach/detach so I didn't touch it.

SiegeLord commented 8 years ago

Thanks!