zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit ebf2a7e9b9c73a3578f7243cd9cf27f2fdf553a5 (tree)
parent 8ea2b40e5f621482d714fdd7cb05bbc592fc550b
Author: Sébastien Marie <semarie@online.fr>
Date:   Tue, 12 Jan 2021 05:39:46 +0000

add pthread_key functions

Diffstat:
Mlib/std/c.zig | 4++++
Mlib/std/c/openbsd.zig | 1+
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/std/c.zig b/lib/std/c.zig @@ -271,6 +271,10 @@ pub extern "c" fn pthread_atfork( parent: ?fn () callconv(.C) void, child: ?fn () callconv(.C) void, ) c_int; +pub extern "c" fn pthread_key_create(key: *pthread_key_t, destructor: ?fn (value: *c_void) callconv(.C) void) c_int; +pub extern "c" fn pthread_key_delete(key: pthread_key_t) c_int; +pub extern "c" fn pthread_getspecific(key: pthread_key_t) ?*c_void; +pub extern "c" fn pthread_setspecific(key: pthread_key_t, value: ?*c_void) c_int; pub extern "c" fn sem_init(sem: *sem_t, pshared: c_int, value: c_uint) c_int; pub extern "c" fn sem_destroy(sem: *sem_t) c_int; pub extern "c" fn sem_post(sem: *sem_t) c_int; diff --git a/lib/std/c/openbsd.zig b/lib/std/c/openbsd.zig @@ -33,6 +33,7 @@ pub const pthread_spinlock_t = extern struct { pub const pthread_attr_t = extern struct { inner: ?*c_void = null, }; +pub const pthread_key_t = c_int; pub const sem_t = ?*opaque {};