summaryrefslogtreecommitdiff
path: root/src/thread/pthread_setcancelstate.c
blob: a85cc800f7c64f8736133c2fad6ec6bff3ee791f (plain)
1
2
3
4
5
6
7
8
9
10
#include "pthread_impl.h"

int pthread_setcancelstate(int new, int *old)
{
	struct pthread *self = pthread_self();
	if (old) *old = self->canceldisable & 1;
	if ((unsigned)new > 1) return EINVAL;
	self->canceldisable = (self->canceldisable & ~1) | new;
	return 0;
}