diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-04-26 19:21:05 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-04-26 19:21:05 -0700 |
commit | ef1c52053755fa14b4ca98b22c506f73f5f4a4b7 (patch) | |
tree | cc0983abdea5a3f92ed8a9a54e68bd85cbeb4716 /hw/xquartz/threadSafety.h | |
parent | b114d4e861885cc5b49cd81b33ad825461811b3e (diff) |
XQuartz: Cleaned up startup and thread creation a tad.
(cherry picked from commit c861fe00e112b21ee0156d09a6cd5281642a1dcc)
Diffstat (limited to 'hw/xquartz/threadSafety.h')
-rw-r--r-- | hw/xquartz/threadSafety.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/hw/xquartz/threadSafety.h b/hw/xquartz/threadSafety.h index ed2ad9ff5..7b009103a 100644 --- a/hw/xquartz/threadSafety.h +++ b/hw/xquartz/threadSafety.h @@ -31,22 +31,23 @@ #include <pthread.h> -extern pthread_t SERVER_THREAD; -extern pthread_t APPKIT_THREAD; - -#define threadSafetyID(tid) (pthread_equal((tid), SERVER_THREAD) ? "X Server Thread" : "Appkit Thread") +extern pthread_t APPKIT_THREAD_ID; +extern pthread_t SERVER_THREAD_ID; /* Dump the call stack */ void spewCallStack(void); /* Print message to ErrorF if we're in the wrong thread */ -void _threadAssert(pthread_t tid, const char *file, const char *fun, int line); +void _threadSafetyAssert(pthread_t tid, const char *file, const char *fun, int line); + +/* Get a string that identifies our thread nicely */ +const char *threadSafetyID(pthread_t tid); -#define threadAssert(tid) _threadAssert(tid, __FILE__, __FUNCTION__, __LINE__) +#define threadSafetyAssert(tid) _threadSafetyAssert(tid, __FILE__, __FUNCTION__, __LINE__) #ifdef DEBUG_THREADS -#define TA_SERVER() threadAssert(SERVER_THREAD) -#define TA_APPKIT() threadAssert(APPKIT_THREAD) +#define TA_APPKIT() threadSafetyAssert(APPKIT_THREAD_ID) +#define TA_SERVER() threadSafetyAssert(SERVER_THREAD_ID) #else #define TA_SERVER() #define TA_APPKIT() |