diff options
author | rpj <rpj> | 2002-02-02 23:15:28 +0000 |
---|---|---|
committer | rpj <rpj> | 2002-02-02 23:15:28 +0000 |
commit | 4a72430d821b96add23846980d07f5a01059029d (patch) | |
tree | 6601b116e591db28feaed15a92ae46bfed8197da /private.c | |
parent | 6a65a568fa4d9515265842c8bcf11a7449f3c325 (diff) |
* cancel.c: Rearranged some code and introduced checks
to disable cancelation at the start of a thread's cancelation
run to prevent double cancelation. The main problem
arises if a thread is canceling and then receives a subsequent
async cancel request.
* private.c: Likewise.
* condvar.c: Place pragmas around cleanup_push/pop to turn
off inline optimisation (/Obn where n>0 - MSVC only). Various
optimisation switches in MSVC turn this on, which interferes with
the way that cleanup handlers are run in C++ EH and SEH
code. Application code compiled with inline optimisation must
also wrap cleanup_push/pop blocks with the pragmas, e.g.
#pragma inline_depth(0)
pthread_cleanup_push(...)
...
pthread_cleanup_pop(...)
#pragma inline_depth(8)
* rwlock.c: Likewise.
* mutex.c: Remove attempts to inline some functions.
* signal.c: Modify misleading comment.
tests/
* mutex8: New test.
* mutex8n: New test.
* mutex8e: New test.
* mutex8r: New test.
* cancel6a: New test.
* cancel6d: New test.
* cleanup0.c: Add pragmas for inline optimisation control.
* cleanup1.c: Add pragmas for inline optimisation control.
* cleanup2.c: Add pragmas for inline optimisation control.
* cleanup3.c: Add pragmas for inline optimisation control.
* condvar7.c: Add pragmas for inline optimisation control.
* condvar8.c: Add pragmas for inline optimisation control.
* condvar9.c: Add pragmas for inline optimisation control.
Diffstat (limited to 'private.c')
-rw-r--r-- | private.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -272,6 +272,8 @@ ptw32_threadStart (void * vthreadParms) pthread_setspecific (ptw32_selfThreadKey, self); + self->state = PThreadStateRunning; + #ifdef __CLEANUP_SEH __try @@ -366,7 +368,7 @@ ptw32_threadStart (void * vthreadParms) * We want to run the user's terminate function if supplied. * That function may call pthread_exit() or be canceled, which will * be handled by the outer try block. - * + * * ptw32_terminate() will be called if there is no user * supplied function. */ @@ -408,6 +410,9 @@ ptw32_threadStart (void * vthreadParms) * and release the exception out of thread scope. */ status = self->exitStatus = PTHREAD_CANCELED; + (void) pthread_mutex_lock(&self->cancelLock); + self->state = PThreadStateException; + (void) pthread_mutex_unlock(&self->cancelLock); (void) pthread_mutex_destroy(&self->cancelLock); (void) set_terminate(ptw32_oldTerminate); ptw32_callUserDestroyRoutines(self); @@ -428,6 +433,10 @@ ptw32_threadStart (void * vthreadParms) #endif /* __CLEANUP_C */ #endif /* __CLEANUP_SEH */ + (void) pthread_mutex_lock(&self->cancelLock); + self->state = PThreadStateLast; + (void) pthread_mutex_unlock(&self->cancelLock); + (void) pthread_mutex_destroy(&self->cancelLock); |