Changeset 30842 in webkit for trunk/JavaScriptCore/wtf


Ignore:
Timestamp:
Mar 6, 2008, 9:50:08 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

<rdar://problem/5687269> Need to create a Collator abstraction for WebCore and JavaScriptCore

Location:
trunk/JavaScriptCore/wtf
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/Threading.h

    r30522 r30842  
    9292#include <stdint.h>
    9393
     94// For portability, we do not use thread-safe statics natively supported by some compilers (e.g. gcc).
     95#define AtomicallyInitializedStatic(T, name) \
     96    WTF::atomicallyInitializedStaticMutex->lock(); \
     97    static T name; \
     98    WTF::atomicallyInitializedStaticMutex->unlock();
     99
    94100namespace WTF {
    95101
     
    233239void initializeThreading();
    234240
     241extern Mutex* atomicallyInitializedStaticMutex;
     242
    235243#if !PLATFORM(GTK)
    236244inline void initializeThreading()
    237245{
     246    if (!atomicallyInitializedStaticMutex)
     247        atomicallyInitializedStaticMutex = new Mutex;
    238248}
    239249#endif
  • trunk/JavaScriptCore/wtf/ThreadingGtk.cpp

    r30523 r30842  
    3737namespace WTF {
    3838
     39Mutex* atomicallyInitializedStaticMutex;
     40
    3941void initializeThreading()
    4042{
    41     if (!g_thread_supported())
     43    if (!g_thread_supported()) {
    4244        g_thread_init(NULL);
     45        ASSERT(!atomicallyInitializedStaticMutex);
     46        atomicallyInitializedStaticMutex = new Mutex;
     47    }
    4348    ASSERT(g_thread_supported());
    4449}
  • trunk/JavaScriptCore/wtf/ThreadingNone.cpp

    r30525 r30842  
    3232namespace WTF {
    3333
     34Mutex* atomicallyInitializedStaticMutex;
     35
    3436ThreadIdentifier createThread(ThreadFunction, void*) { return 0; }
    3537int waitForThreadCompletion(ThreadIdentifier, void**) { return 0; }
  • trunk/JavaScriptCore/wtf/ThreadingPthreads.cpp

    r30522 r30842  
    3636namespace WTF {
    3737
     38Mutex* atomicallyInitializedStaticMutex;
     39
    3840static Mutex& threadMapMutex()
    3941{
  • trunk/JavaScriptCore/wtf/ThreadingWin.cpp

    r30527 r30842  
    6868
    6969namespace WTF {
     70
     71Mutex* atomicallyInitializedStaticMutex;
    7072
    7173static Mutex& threadMapMutex()
Note: See TracChangeset for help on using the changeset viewer.