summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/wtf/MainThread.h
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/wtf/MainThread.h')
-rw-r--r--JavaScriptCore/wtf/MainThread.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/JavaScriptCore/wtf/MainThread.h b/JavaScriptCore/wtf/MainThread.h
index 8c0275b..d037d0b 100644
--- a/JavaScriptCore/wtf/MainThread.h
+++ b/JavaScriptCore/wtf/MainThread.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
*
* Redistribution and use in source and binary forms, with or without
@@ -30,32 +30,40 @@
#ifndef MainThread_h
#define MainThread_h
-namespace WTF {
+#include <stdint.h>
-class Mutex;
+namespace WTF {
+typedef uint32_t ThreadIdentifier;
typedef void MainThreadFunction(void*);
-void callOnMainThread(MainThreadFunction*, void* context);
+// Must be called from the main thread.
+void initializeMainThread();
-// Blocks the thread until the call finishes on the main thread. Misusing this can easily cause deadlocks.
+void callOnMainThread(MainThreadFunction*, void* context);
void callOnMainThreadAndWait(MainThreadFunction*, void* context);
-
void setMainThreadCallbacksPaused(bool paused);
-// Must be called from the main thread (Darwin is an exception to this rule).
-void initializeMainThread();
+bool isMainThread();
-// These functions are internal to the callOnMainThread implementation.
+// NOTE: these functions are internal to the callOnMainThread implementation.
void initializeMainThreadPlatform();
void scheduleDispatchFunctionsOnMainThread();
-Mutex& mainThreadFunctionQueueMutex();
void dispatchFunctionsFromMainThread();
+#if PLATFORM(MAC)
+// This version of initializeMainThread sets up the main thread as corresponding
+// to the process's main thread, and not necessarily the thread that calls this
+// function. It should only be used as a legacy aid for Mac WebKit.
+void initializeMainThreadToProcessMainThread();
+void initializeMainThreadToProcessMainThreadPlatform();
+#endif
+
} // namespace WTF
using WTF::callOnMainThread;
using WTF::callOnMainThreadAndWait;
using WTF::setMainThreadCallbacksPaused;
+using WTF::isMainThread;
#endif // MainThread_h