From 0cb718c4d6d97a8726f869d7cdb8af6d8845d9d6 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Mon, 5 Jun 2000 14:38:59 +0000 Subject: [PATCH] threadPrivateGet must return 0 before first call to threadPrivateSet --- src/libCom/osi/os/vxWorks/osdThread.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/libCom/osi/os/vxWorks/osdThread.c b/src/libCom/osi/os/vxWorks/osdThread.c index 5aac9ad1c..05a60a97f 100644 --- a/src/libCom/osi/os/vxWorks/osdThread.c +++ b/src/libCom/osi/os/vxWorks/osdThread.c @@ -101,18 +101,19 @@ void threadOnceOsd(threadOnceId *id, void (*func)(void *), void *arg) } semGive(threadOnceMutex); } - + static void createFunction(THREADFUNC func, void *parm) { int tid = taskIdSelf(); taskVarAdd(tid,(int *)&papTSD); + /*Make sure that papTSD is still 0 after that call to taskVarAdd*/ papTSD = 0; (*func)(parm); taskVarDelete(tid,(int *)&papTSD); free(papTSD); } - + threadId threadCreate(const char *name, unsigned int priority, unsigned int stackSize, THREADFUNC funptr,void *parm) @@ -297,20 +298,17 @@ void threadPrivateDelete(threadPrivateId id) void threadPrivateSet (threadPrivateId id, void *pvt) { int indpthreadPrivate = (int)id; + int nthreadPrivateOld = 0; + + if(papTSD) nthreadPrivateOld = (int)papTSD[0]; + if(!papTSD || (nthreadPrivateOld