Safer way to create the global mutex.

__attribute__((constructor)) might not have been called when the runtime
is first used. However, the first usage of the runtime is always
single-threaded, so it is safe to do it this way.