From 740f2de82a42dd3d96e6cfb60e34d6d51160e274 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Wed, 15 Mar 2000 21:36:02 +0000 Subject: [PATCH] add test for threadPrivate --- src/libCom/test/threadTest.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libCom/test/threadTest.c b/src/libCom/test/threadTest.c index 2d0ebfd4a..784fa9fc9 100644 --- a/src/libCom/test/threadTest.c +++ b/src/libCom/test/threadTest.c @@ -20,13 +20,19 @@ of this distribution. #include "osiSem.h" #include "errlog.h" +threadPrivateId privateKey; static void threadFunc(void *arg) { + int myPrivate; int argvalue = *(int *)arg; + myPrivate = argvalue; + threadPrivateSet(privateKey,(void *)argvalue); errlogPrintf("threadFunc %d starting\n",argvalue); threadSleep(2.0); - errlogPrintf("threadFunc %d stopping\n",argvalue); + argvalue = -1; + argvalue = (int)threadPrivateGet(privateKey); + errlogPrintf("threadFunc %d stopping myPrivate %d\n",argvalue,myPrivate); } void threadTest(int ntasks,int verbose) @@ -48,6 +54,7 @@ void threadTest(int ntasks,int verbose) errlogPrintf("threadTest starting\n"); stackSize = threadGetStackSize(threadStackSmall); errlogPrintf("stackSize %u\n",stackSize); + privateKey = threadPrivateCreate(); for(i=0; i