123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #include "pthread.h"
- #include "implement.h"
- void
- pthread_testcancel (void)
- {
- pthread_t self = pthread_self ();
- pte_thread_t * sp = (pte_thread_t *) self;
- if (sp == NULL)
- {
- return;
- }
-
- if (sp->state != PThreadStateCancelPending)
- {
- return;
- }
- (void) pthread_mutex_lock (&sp->cancelLock);
- if (sp->cancelState != PTHREAD_CANCEL_DISABLE)
- {
- sp->state = PThreadStateCanceling;
- sp->cancelState = PTHREAD_CANCEL_DISABLE;
- (void) pthread_mutex_unlock (&sp->cancelLock);
- pte_throw (PTE_EPS_CANCEL);
- }
- (void) pthread_mutex_unlock (&sp->cancelLock);
- }
|