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/ThreadingPthreads.cpp

    r31560 r31690  
    4040Mutex* atomicallyInitializedStaticMutex;
    4141
     42static ThreadIdentifier mainThreadIdentifier;
     43
    4244void initializeThreading()
    4345{
     
    4547        atomicallyInitializedStaticMutex = new Mutex;
    4648        wtf_random_init();
     49        mainThreadIdentifier = currentThread();
    4750    }
    4851}
     
    145148}
    146149
     150bool isMainThread()
     151{
     152    return currentThread() == mainThreadIdentifier;
     153}
     154
    147155Mutex::Mutex()
    148156{
Note: See TracChangeset for help on using the changeset viewer.