minor locking optimizations
[musl] / src / thread / cancellation.c
1 #include "pthread_impl.h"
2
3 #ifdef __pthread_register_cancel
4 #undef __pthread_register_cancel
5 #undef __pthread_unregister_cancel
6 #define __pthread_register_cancel __pthread_register_cancel_3
7 #define __pthread_unregister_cancel __pthread_unregister_cancel_3
8 #endif
9
10 void __pthread_register_cancel(struct __ptcb *cb)
11 {
12         struct pthread *self = pthread_self();
13         cb->__next = self->cancelbuf;
14         self->cancelbuf = cb;
15 }
16
17 void __pthread_unregister_cancel(struct __ptcb *cb)
18 {
19         struct pthread *self = __pthread_self();
20         self->cancelbuf = self->cancelbuf->__next;
21 }