Ignore:
Timestamp:
Jan 8, 2016, 10:20:43 AM (9 years ago)
Author:
[email protected]
Message:

[JSC] Use std::call_once instead of pthread_once when initializing LLVM.
https://bugs.webkit.org/show_bug.cgi?id=152893

Reviewed by Mark Lam.

Use std::call_once since pthreads is not present on all platforms.

  • llvm/InitializeLLVM.cpp:

(JSC::initializeLLVMImpl):
(JSC::initializeLLVM):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/llvm/InitializeLLVM.cpp

    r191058 r194769  
    3131#include "LLVMAPI.h"
    3232#include "Options.h"
    33 #include <pthread.h>
     33#include <mutex>
    3434#include <wtf/DataLog.h>
    3535
    3636namespace JSC {
    37 
    38 static pthread_once_t initializeLLVMOnceKey = PTHREAD_ONCE_INIT;
    3937
    4038static void initializeLLVMImpl()
     
    6866bool initializeLLVM()
    6967{
    70     pthread_once(&initializeLLVMOnceKey, initializeLLVMImpl);
     68    static std::once_flag initializeLLVMOnceKey;
     69
     70    std::call_once(initializeLLVMOnceKey, initializeLLVMImpl);
    7171    return !!llvm;
    7272}
Note: See TracChangeset for help on using the changeset viewer.