Changeset 160116 in webkit


Ignore:
Timestamp:
Dec 4, 2013 12:43:21 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by peavo@outlook.com <peavo@outlook.com> on 2013-12-04
Reviewed by Brent Fulgham.

  • runtime/InitializeThreading.cpp:

(JSC::initializeThreading):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r160115 r160116  
     12013-12-04  peavo@outlook.com  <peavo@outlook.com>
     2
     3        Use ThreadingOnce class to encapsulate pthread_once functionality.
     4        https://bugs.webkit.org/show_bug.cgi?id=125228
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * runtime/InitializeThreading.cpp:
     9        (JSC::initializeThreading):
     10
    1112013-12-04  Mark Lam  <mark.lam@apple.com>
    212
  • 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.