mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 15:03:34 +00:00
20 lines
609 B
C
20 lines
609 B
C
|
#ifndef COSMOPOLITAN_LIBC_CALLS_BLOCKCANCEL_H_
|
||
|
#define COSMOPOLITAN_LIBC_CALLS_BLOCKCANCEL_H_
|
||
|
#include "libc/thread/thread.h"
|
||
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||
|
COSMOPOLITAN_C_START_
|
||
|
|
||
|
#define BLOCK_CANCELLATIONS \
|
||
|
do { \
|
||
|
int _CancelState; \
|
||
|
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &_CancelState)
|
||
|
|
||
|
#define ALLOW_CANCELLATIONS \
|
||
|
pthread_setcancelstate(_CancelState, 0); \
|
||
|
} \
|
||
|
while (0)
|
||
|
|
||
|
COSMOPOLITAN_C_END_
|
||
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||
|
#endif /* COSMOPOLITAN_LIBC_CALLS_BLOCKCANCEL_H_ */
|