Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Implement pthread_setcancelstate
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabla committed Jan 4, 2018
1 parent 5138f5b commit 67de808
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pthread/rthread_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,25 +431,24 @@ pthread_testcancel(void)
int
pthread_setcancelstate(int state, int *oldstatep)
{
return ENOSYS;
#if 0
struct tib *tib = TIB_GET();
pthread_t self = pthread_self();
int oldstate;

oldstate = tib->tib_cantcancel & CANCEL_DISABLED ?
if (self == NULL)
return (EINVAL);
oldstate = self->tib_cantcancel & CANCEL_DISABLED ?
PTHREAD_CANCEL_DISABLE : PTHREAD_CANCEL_ENABLE;
if (state == PTHREAD_CANCEL_ENABLE) {
tib->tib_cantcancel &= ~CANCEL_DISABLED;
self->tib_cantcancel &= ~CANCEL_DISABLED;
} else if (state == PTHREAD_CANCEL_DISABLE) {
tib->tib_cantcancel |= CANCEL_DISABLED;
self->tib_cantcancel |= CANCEL_DISABLED;
} else {
return (EINVAL);
}
if (oldstatep)
*oldstatep = oldstate;

return (0);
#endif
}

int
Expand Down

0 comments on commit 67de808

Please sign in to comment.