Don't use C constructors for initializing critical sections on Windows
@nirbheek
Submitted by Nirbheek Chauhan Link to original bug (#754027)
Description
Created attachment 309924
Don't use C constructors for initializing critical sections on Windows
Instead, use memory barriers and just initialize it as part of orc_init().
Also, require that some sort of threading library be available.
C constructors are toolchain-specific which brings its own set of problems.
There's no guarantees about the order in which C constructors are called, it
makes it impossible to use static libraries built with one toolchain on another
one, and so on.
Finally, C constructors are only useful when you need a single point of entry
for initializing data shared throughout the library. Orc already has a function
for doing that; namely orc_init(), so we can just use that.
The atomic set/get of cs_inited using MemoryBarrier() was inspired by GLib's
g_atomic_int_set/get implementation.
Patch 309924, "Don't use C constructors for initializing critical sections on Windows":
0001-orc-Don-t-use-C-constructors-for-initializing-critic.patch