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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent cc0975a1
2013-12-04 peavo@outlook.com <peavo@outlook.com>
Use ThreadingOnce class to encapsulate pthread_once functionality.
https://bugs.webkit.org/show_bug.cgi?id=125228
Reviewed by Brent Fulgham.
* runtime/InitializeThreading.cpp:
(JSC::initializeThreading):
2013-12-04 Mark Lam <mark.lam@apple.com>
Remove unneeded semicolons.
......
......@@ -41,16 +41,13 @@
#include "WriteBarrier.h"
#include <wtf/dtoa.h>
#include <wtf/Threading.h>
#include <wtf/ThreadingOnce.h>
#include <wtf/dtoa/cached-powers.h>
using namespace WTF;
namespace JSC {
#if OS(DARWIN)
static pthread_once_t initializeThreadingKeyOnce = PTHREAD_ONCE_INIT;
#endif
static void initializeThreadingOnce()
{
WTF::double_conversion::initialize();
......@@ -76,15 +73,8 @@ static void initializeThreadingOnce()
void initializeThreading()
{
#if OS(DARWIN)
pthread_once(&initializeThreadingKeyOnce, initializeThreadingOnce);
#else
static bool initializedThreading = false;
if (!initializedThreading) {
initializeThreadingOnce();
initializedThreading = true;
}
#endif
static WTF::ThreadingOnce initializeThreadingKeyOnce;
initializeThreadingKeyOnce.callOnce(initializeThreadingOnce);
}
} // namespace JSC
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment