summaryrefslogtreecommitdiffstats
path: root/chrome/browser/zygote_main_linux.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/zygote_main_linux.cc')
-rw-r--r--chrome/browser/zygote_main_linux.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index 98f4701..3e3265a 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -465,12 +465,11 @@ struct tm* localtime(const time_t* timep) {
return &time_struct;
} else {
typedef struct tm* (*LocaltimeFunction)(const time_t* timep);
- static LocaltimeFunction libc_localtime;
- static bool have_libc_localtime = false;
- if (!have_libc_localtime) {
- libc_localtime = (LocaltimeFunction) dlsym(RTLD_NEXT, "localtime");
- have_libc_localtime = true;
- }
+ // This static declaration is desugared by the compiler into a locked
+ // initialisation which will only call dlsym once, across all threads.
+ // See: http://gcc.gnu.org/ml/gcc-patches/2004-08/msg01598.html
+ static LocaltimeFunction libc_localtime =
+ (LocaltimeFunction) dlsym(RTLD_NEXT, "localtime");
if (!libc_localtime) {
// http://code.google.com/p/chromium/issues/detail?id=16800