diff options
| author | Andrew Kelley <andrewrk@noreply.codeberg.org> | 2025-12-02 17:58:29 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrewrk@noreply.codeberg.org> | 2025-12-02 17:58:29 +0100 |
| commit | 52ad126bb4720ff894e994ff890532e7fc7b3364 (patch) | |
| tree | e018d8ea82b13a0b1a73c04b4688adecc963e3a4 /lib/std/c.zig | |
| parent | 95f93a0b281e32583edef36808231a5f61fb7de1 (diff) | |
| parent | bb3f56d5d5424c7be42132c047a7146e82b49c74 (diff) | |
| download | zig-52ad126bb4720ff894e994ff890532e7fc7b3364.tar.gz zig-52ad126bb4720ff894e994ff890532e7fc7b3364.zip | |
Merge pull request 'std.Io.Threaded: rework cancellation' (#30033) from cancellation into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30033
Diffstat (limited to 'lib/std/c.zig')
| -rw-r--r-- | lib/std/c.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/std/c.zig b/lib/std/c.zig index f22112a086..886c5e902c 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -10881,6 +10881,23 @@ pub extern "c" fn pthread_create( start_routine: *const fn (?*anyopaque) callconv(.c) ?*anyopaque, noalias arg: ?*anyopaque, ) E; +pub const pthread_cancelstate = switch (native_os) { + .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => enum(c_int) { + ENABLE = 1, + DISABLE = 0, + }, + .linux => if (native_abi.isMusl()) enum(c_int) { + ENABLE = 0, + DISABLE = 1, + MASKED = 2, + } else if (native_abi.isGnu()) enum(c_int) { + ENABLE = 0, + DISABLE = 1, + }, + else => void, +}; +pub extern "c" fn pthread_setcancelstate(pthread_cancelstate, ?*pthread_cancelstate) E; +pub extern "c" fn pthread_cancel(pthread_t) E; pub extern "c" fn pthread_attr_init(attr: *pthread_attr_t) E; pub extern "c" fn pthread_attr_setstack(attr: *pthread_attr_t, stackaddr: *anyopaque, stacksize: usize) E; pub extern "c" fn pthread_attr_setstacksize(attr: *pthread_attr_t, stacksize: usize) E; |
