mirror of
https://github.com/fluencelabs/musl
synced 2025-06-28 22:22:01 +00:00
new framework to inhibit thread cancellation when needed
with these small changes, libc functions which need to call functions which are cancellation points, but which themselves must not be cancellation points, can use the CANCELPT_INHIBIT and CANCELPT_RESUME macros to temporarily inhibit all cancellation.
This commit is contained in:
@ -3,8 +3,8 @@
|
||||
int pthread_setcancelstate(int new, int *old)
|
||||
{
|
||||
struct pthread *self = pthread_self();
|
||||
if (old) *old = self->canceldisable;
|
||||
if (old) *old = self->canceldisable & 1;
|
||||
if ((unsigned)new > 1) return EINVAL;
|
||||
self->canceldisable = new;
|
||||
self->canceldisable = (self->canceldisable & ~1) | new;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user