5 * Copyright (C) 2006, 2007, Apple Inc. All rights reserved.
9 #import <GraphicsServices/GSEvent.h>
11 #ifndef WebCoreThread_h
12 #define WebCoreThread_h
14 #if defined(__cplusplus)
19 CGContextRef currentCGContext
;
22 extern bool webThreadShouldYield
;
24 // The lock is automatically freed at the bottom of the runloop. No need to unlock.
25 // Note that calling this function may hang your UI for several seconds. Don't use
26 // unless you have to.
27 void WebThreadLock(void);
29 // This is a no-op for compatibility only. It will go away. Please don't use.
30 void WebThreadUnlock(void);
32 // Please don't use anything below this line unless you know what you are doing. If unsure, ask.
33 // ---------------------------------------------------------------------------------------------
34 bool WebTryThreadLock(void);
35 bool WebThreadIsLocked(void);
36 bool WebThreadIsLockedOrDisabled(void);
38 void WebThreadLockPushModal(void);
39 void WebThreadLockPopModal(void);
41 void WebThreadEnable(void);
42 bool WebThreadIsEnabled(void);
43 bool WebThreadIsCurrent(void);
44 bool WebThreadNotCurrent(void);
46 // These are for <rdar://problem/6817341> Many apps crashing calling -[UIFieldEditor text] in secondary thread
47 // Don't use them to solve any random problems you might have.
48 void WebThreadLockFromAnyThread();
49 void WebThreadUnlockFromAnyThread();
51 static inline bool WebThreadShouldYield(void) { return webThreadShouldYield
; }
52 static inline void WebThreadSetShouldYield() { webThreadShouldYield
= true; }
54 CFRunLoopRef
WebThreadRunLoop(void);
55 WebThreadContext
*WebThreadCurrentContext(void);
56 bool WebThreadContextIsCurrent(void);
58 void WebThreadPrepareForDrawing(void);
60 #if defined(__cplusplus)
64 #endif // WebCoreThread_h