Ignore:
Timestamp:
Dec 4, 2013, 12:43:21 PM (12 years ago)
Author:
[email protected]
Message:

Use ThreadingOnce class to encapsulate pthread_once functionality.
https://bugs.webkit.org/show_bug.cgi?id=125228

Patch by [email protected] <[email protected]> on 2013-12-04
Reviewed by Brent Fulgham.

  • runtime/InitializeThreading.cpp:

(JSC::initializeThreading):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp

    r157539 r160116  
    4242#include <wtf/dtoa.h>
    4343#include <wtf/Threading.h>
     44#include <wtf/ThreadingOnce.h>
    4445#include <wtf/dtoa/cached-powers.h>
    4546
     
    4748
    4849namespace JSC {
    49 
    50 #if OS(DARWIN)
    51 static pthread_once_t initializeThreadingKeyOnce = PTHREAD_ONCE_INIT;
    52 #endif
    5350
    5451static void initializeThreadingOnce()
     
    7774void initializeThreading()
    7875{
    79 #if OS(DARWIN)
    80     pthread_once(&initializeThreadingKeyOnce, initializeThreadingOnce);
    81 #else
    82     static bool initializedThreading = false;
    83     if (!initializedThreading) {
    84         initializeThreadingOnce();
    85         initializedThreading = true;
    86     }
    87 #endif
     76    static WTF::ThreadingOnce initializeThreadingKeyOnce;
     77    initializeThreadingKeyOnce.callOnce(initializeThreadingOnce);
    8878}
    8979
Note: See TracChangeset for help on using the changeset viewer.