diff options
author | rpj <rpj> | 2010-06-20 03:31:18 +0000 |
---|---|---|
committer | rpj <rpj> | 2010-06-20 03:31:18 +0000 |
commit | a3ea0b24409b89bd08c0a2268dbae834724734df (patch) | |
tree | 4629fd085756226f0cee8beba4faf66466ef0410 /tests/once3.c | |
parent | 135d6f060c5e5232311af77bd0d0f500e861290c (diff) |
See ChangeLogs: preparing for new release.
Diffstat (limited to 'tests/once3.c')
-rw-r--r-- | tests/once3.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/once3.c b/tests/once3.c index 51d2daa..c706f80 100644 --- a/tests/once3.c +++ b/tests/once3.c @@ -34,7 +34,7 @@ * -------------------------------------------------------------------------- * * Create several pthread_once objects and channel several threads - * through each. Make the init_routine cancelable and cancel them + * through each. Make the init_routine cancelable and cancel them with * waiters waiting. * * Depends on API functions: @@ -45,6 +45,8 @@ * pthread_once() */ +/* #define ASSERT_TRACE */ + #include "test.h" #define NUM_THREADS 100 /* Targeting each once control */ @@ -66,6 +68,7 @@ myfunc(void) { EnterCriticalSection(&numOnce.cs); numOnce.i++; + assert(numOnce.i > 0); LeaveCriticalSection(&numOnce.cs); /* Simulate slow once routine so that following threads pile up behind it */ Sleep(10); @@ -78,11 +81,11 @@ mythread(void * arg) { /* * Cancel every thread. These threads are deferred cancelable only, so - * only the thread performing the init_routine will see it (there are + * only the thread performing the once routine (my_func) will see it (there are * no other cancelation points here). The result will be that every thread - * eventually cancels only when it becomes the new initter. + * eventually cancels only when it becomes the new once thread. */ - pthread_cancel(pthread_self()); + assert(pthread_cancel(pthread_self()) == 0); assert(pthread_once(&once[(int) arg], myfunc) == 0); EnterCriticalSection(&numThreads.cs); numThreads.i++; |