From 2fddb8a9989eda4abb38c6c446298698b6a35bc4 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Thu, 17 Feb 2000 17:17:01 +0000 Subject: [PATCH] get rid of threadIsReady --- src/libCom/osi/os/RTEMS/osdThread.c | 6 ---- src/libCom/osi/os/WIN32/osdThread.c | 10 +----- src/libCom/osi/os/posix/osdThread.c | 49 +++++++++++++++++++++++++---- src/libCom/test/timerTest.c | 1 - 4 files changed, 44 insertions(+), 22 deletions(-) diff --git a/src/libCom/osi/os/RTEMS/osdThread.c b/src/libCom/osi/os/RTEMS/osdThread.c index 25808826d..3ca7d2b03 100644 --- a/src/libCom/osi/os/RTEMS/osdThread.c +++ b/src/libCom/osi/os/RTEMS/osdThread.c @@ -192,12 +192,6 @@ threadIsSuspended (threadId id) } } -int -threadIsReady (threadId id) -{ - return !threadIsSuspended(id); -} - void threadSleep (double seconds) { diff --git a/src/libCom/osi/os/WIN32/osdThread.c b/src/libCom/osi/os/WIN32/osdThread.c index 5cbb24c7a..f2182941c 100644 --- a/src/libCom/osi/os/WIN32/osdThread.c +++ b/src/libCom/osi/os/WIN32/osdThread.c @@ -319,14 +319,6 @@ epicsShareFunc int epicsShareAPI threadIsSuspended (threadId id) } } -/* - * threadIsReady () - */ -epicsShareFunc int epicsShareAPI threadIsReady (threadId id) -{ - return !threadIsSuspended (id); -} - /* * threadSleep () */ @@ -376,4 +368,4 @@ epicsShareFunc void * epicsShareAPI threadPrivateGet (threadVarId id) { struct osdThreadPrivate *pPvt = (struct osdThreadPrivate *) id; return (void *) TlsGetValue (pPvt->key); -} \ No newline at end of file +} diff --git a/src/libCom/osi/os/posix/osdThread.c b/src/libCom/osi/os/posix/osdThread.c index 3f1d1b261..062d68b3e 100644 --- a/src/libCom/osi/os/posix/osdThread.c +++ b/src/libCom/osi/os/posix/osdThread.c @@ -260,13 +260,9 @@ int threadIsEqual(threadId id1, threadId id2) return(pthread_equal(p1->tid,p2->tid)); } -int threadIsReady(threadId id) { - threadInfo *pthreadInfo = (threadInfo *)id; - return(pthreadInfo->isSuspended ? 0 : 1); -} - int threadIsSuspended(threadId id) { - return(threadIsReady(id) ? 0 : 1); + threadInfo *pthreadInfo = (threadInfo *)id; + return(pthreadInfo->isSuspended ? 1 : 0); } void threadSleep(double seconds) @@ -290,3 +286,44 @@ threadId threadGetIdSelf(void) { pthreadInfo = (threadInfo *)pthread_getspecific(getpthreadInfo); return((threadId)pthreadInfo); } + +threadVarId threadPrivateCreate(void) +{ + pthread_key_t *key; + int status; + + key = callocMustSucceed(1,sizeof(pthread_key_t),"threadPrivateCreate"); + status = pthread_key_create(key,0); + checkStatusQuit(status,"pthread_key_create","threadPrivateCreate"); + return((threadVarId)key); +} + +void threadPrivateDelete(threadVarId id) +{ + pthread_key_t *key = (pthread_key_t *)id; + int status; + + status = pthread_key_delete(*key); + checkStatusQuit(status,"pthread_key_delete","threadPrivateDelete"); +} + +void threadPrivateSet (threadVarId id, void *value) +{ + pthread_key_t *key = (pthread_key_t *)id; + int status; + + status = pthread_setspecific(*key,value); + checkStatusQuit(status,"pthread_setspecific","threadPrivateSet"); +} + +void *threadPrivateGet(threadVarId id) +{ + pthread_key_t *key = (pthread_key_t *)id; + int status; + void *value; + + value = pthread_getspecific(*key); + if(!value) + errlogPrintf("threadPrivateGet: pthread_getspecific returned 0\n"); + return(value); +} diff --git a/src/libCom/test/timerTest.c b/src/libCom/test/timerTest.c index 0f9138426..ec04ff594 100644 --- a/src/libCom/test/timerTest.c +++ b/src/libCom/test/timerTest.c @@ -17,7 +17,6 @@ of this distribution. #include "osiThread.h" #include "osiTimer.h" #include "errlog.h" -#include "taskwd.h" #include "tsStamp.h" static void expire(void *pPrivate);