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

    r31560 r31690  
    6464#include "Threading.h"
    6565
     66#include "MainThread.h"
    6667#include <windows.h>
    6768#include <wtf/HashMap.h>
     
    7273Mutex* atomicallyInitializedStaticMutex;
    7374
     75static ThreadIdentifier mainThreadIdentifier;
     76
    7477void initializeThreading()
    7578{
     
    7780        atomicallyInitializedStaticMutex = new Mutex;
    7881        wtf_random_init();
     82        initializeMainThread();
     83        mainThreadIdentifier = currentThread();
    7984    }
    8085}
     
    159164{
    160165    return static_cast<ThreadIdentifier>(::GetCurrentThreadId());
     166}
     167
     168bool isMainThread()
     169{
     170    return currentThread() == mainThreadIdentifier;
    161171}
    162172
Note: See TracChangeset for help on using the changeset viewer.