X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=includes%2FOSThreads.h;h=9a3b5aa6c74e4371997f890da039b6458f2fc9a5;hp=f9af6c408c1bcfa0ae3e6a2d3ba2f37a3947e520;hb=540311cfcf08b7184d7ab57245b18214bd4b9173;hpb=e4fdc426413d178c86d3ba93702aad5eb17734bf diff --git a/includes/OSThreads.h b/includes/OSThreads.h index f9af6c4..9a3b5aa 100644 --- a/includes/OSThreads.h +++ b/includes/OSThreads.h @@ -14,6 +14,14 @@ # if defined(HAVE_PTHREAD_H) && !defined(WANT_NATIVE_WIN32_THREADS) +#if CMINUSMINUS + +#define ACQUIRE_LOCK(mutex) pthread_mutex_lock(mutex) +#define RELEASE_LOCK(mutex) pthread_mutex_unlock(mutex) +#define ASSERT_LOCK_HELD(mutex) /* nothing */ + +#else + #include typedef pthread_cond_t Condition; @@ -68,7 +76,18 @@ typedef pthread_key_t ThreadLocalKey; #endif +#endif // CMINUSMINUS + # elif defined(HAVE_WINDOWS_H) + +#if CMINUSMINUS + +#define ACQUIRE_LOCK(mutex) EnterCriticalSection(mutex) +#define RELEASE_LOCK(mutex) LeaveCriticalSection(mutex) +#define ASSERT_LOCK_HELD(mutex) /* nothing */ + +#else + #include typedef HANDLE Condition; @@ -133,10 +152,14 @@ typedef HANDLE Mutex; #define ASSERT_LOCK_HELD(mutex) /* nothing */ #endif +#endif // CMINUSMINUS + # else # error "Threads not supported" # endif + +#ifndef CMINUSMINUS // // General thread operations // @@ -172,6 +195,9 @@ extern void closeMutex ( Mutex* pMut ); void newThreadLocalKey (ThreadLocalKey *key); void *getThreadLocalVar (ThreadLocalKey *key); void setThreadLocalVar (ThreadLocalKey *key, void *value); +void freeThreadLocalKey (ThreadLocalKey *key); + +#endif // !CMINUSMINUS #else