Ignore:
Timestamp:
Apr 7, 2008, 2:04:38 PM (17 years ago)
Author:
Adam Roben
Message:

Add WTF::isMainThread

Reviewed by Alexey Proskuryakov.

  • wtf/Threading.h: Declare the new function.
  • wtf/ThreadingGtk.cpp: (WTF::initializeThreading): Initialize the main thread identifier. (WTF::isMainThread): Added.
  • wtf/ThreadingNone.cpp: Ditto ThreadingGtk.cpp. (WTF::initializeThreading): (WTF::isMainThread):
  • wtf/ThreadingPthreads.cpp: Ditto. (WTF::initializeThreading): (WTF::isMainThread):
  • wtf/ThreadingWin.cpp: Ditto. (WTF::initializeThreading): (WTF::isMainThread):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/ThreadingGtk.cpp

    r31560 r31690  
    4040Mutex* atomicallyInitializedStaticMutex;
    4141
     42static ThreadIdentifier mainThreadIdentifier;
     43
    4244void initializeThreading()
    4345{
     
    4749        atomicallyInitializedStaticMutex = new Mutex;
    4850        wtf_random_init();
     51        mainThreadIdentifier = currentThread();
    4952    }
    5053    ASSERT(g_thread_supported());
     
    137140        return id;
    138141    return establishIdentifierForThread(currentThread);
     142}
     143
     144bool isMainThread()
     145{
     146    return currentThread() == mainThreadIdentifier;
    139147}
    140148
Note: See TracChangeset for help on using the changeset viewer.