X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fposix%2FOSThreads.c;h=510a51d4451bed7afadb2d793300d75fd342d4e0;hb=52f600c8ea0bf0d9b4c01570e80d70bfa65c43ba;hp=07bd7621309ea8aafd1fad05ec869fb844d40994;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 07bd762..510a51d 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -16,6 +16,7 @@ #if defined(THREADED_RTS) #include "OSThreads.h" #include "RtsUtils.h" +#include "Task.h" #if HAVE_STRING_H #include @@ -92,6 +93,14 @@ osThreadId() return pthread_self(); } +rtsBool +osThreadIsAlive(OSThreadId id STG_UNUSED) +{ + // no good way to implement this on POSIX, AFAICT. Returning true + // is safe. + return rtsTrue; +} + void initMutex(Mutex* pMut) { @@ -105,6 +114,11 @@ initMutex(Mutex* pMut) #endif return; } +void +closeMutex(Mutex* pMut) +{ + pthread_mutex_destroy(pMut); +} void newThreadLocalKey (ThreadLocalKey *key) @@ -134,12 +148,22 @@ setThreadLocalVar (ThreadLocalKey *key, void *value) } } +void +freeThreadLocalKey (ThreadLocalKey *key) +{ + int r; + if ((r = pthread_key_delete(*key)) != 0) { + barf("freeThreadLocalKey: %s", strerror(r)); + } +} + static void * forkOS_createThreadWrapper ( void * entry ) { Capability *cap; cap = rts_lock(); cap = rts_evalStableIO(cap, (HsStablePtr) entry, NULL); + taskTimeStamp(myTask()); rts_unlock(cap); return NULL; }