X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2FOSThreads.h;h=f5c434fc28029088fe2d296ff9c6182e68c7d041;hb=118b39e4db1a8187af52c1ddb1b299021834a5a2;hp=fd57f56606bb0211e01db2c9847929494875735b;hpb=ee8e3c3f0124c6ca53fecae80a673c79168dedf8;p=ghc-hetmet.git diff --git a/includes/OSThreads.h b/includes/OSThreads.h index fd57f56..f5c434f 100644 --- a/includes/OSThreads.h +++ b/includes/OSThreads.h @@ -54,6 +54,11 @@ typedef pthread_key_t ThreadLocalKey; barf("RELEASE_LOCK: I do not own this lock: %s %d", __FILE__,__LINE__); \ } +// Note: this assertion calls pthread_mutex_lock() on a mutex that +// is already held by the calling thread. The mutex should therefore +// have been created with PTHREAD_MUTEX_ERRORCHECK, otherwise this +// assertion will hang. We always initialise mutexes with +// PTHREAD_MUTEX_ERRORCHECK when DEBUG is on (see rts/posix/OSThreads.h). #define ASSERT_LOCK_HELD(mutex) ASSERT(pthread_mutex_lock(mutex) == EDEADLK) #endif // CMINUSMINUS @@ -180,6 +185,9 @@ void *getThreadLocalVar (ThreadLocalKey *key); void setThreadLocalVar (ThreadLocalKey *key, void *value); void freeThreadLocalKey (ThreadLocalKey *key); +// Processors and affinity +nat getNumberOfProcessors (void); +void setThreadAffinity (nat n, nat m); #endif // !CMINUSMINUS #else