Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: src/platform-posix.cc

Issue 9664067: Use lazy instance initializer to remove static initializers in two places. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/platform-win32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-posix.cc
===================================================================
--- src/platform-posix.cc (revision 11012)
+++ src/platform-posix.cc (working copy)
@@ -127,13 +127,13 @@
}
-static Mutex* math_function_mutex = OS::CreateMutex();
+static LazyMutex math_function_mutex = LAZY_MUTEX_INITIALIZER;
#define UNARY_MATH_FUNCTION(name, generator) \
static UnaryMathFunction fast_##name##_function = NULL; \
double fast_##name(double x) { \
if (fast_##name##_function == NULL) { \
- ScopedLock lock(math_function_mutex); \
+ ScopedLock lock(math_function_mutex.Pointer()); \
UnaryMathFunction temp = generator; \
MemoryBarrier(); \
fast_##name##_function = temp; \
« no previous file with comments | « no previous file | src/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698