Bug 1412717 - Make malloc_initialized atomic. r=njn

Interestingly, this turns single-instruction checks into
two-instructions checks (at least with GCC, from one cmpb to a movl
followed by a testl), but this is due to Atomic<bool> being actually
backed by a uint32_t, not by the use of atomics.

--HG--
extra : rebase_source : cfc0bec2113b44635120216b4abbbbbe9028b286
This commit is contained in:
Mike Hommey 2017-10-30 09:30:41 +09:00
parent 68626e182f
commit 7f63a01cca

View File

@ -507,7 +507,7 @@ private:
};
// Set to true once the allocator has been initialized.
static bool malloc_initialized = false;
static mozilla::Atomic<bool> malloc_initialized(false);
#if defined(XP_WIN)
// No init lock for Windows.