mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
Merge pull request 'libc: add common implementations of pthread_spin_*' (#31990) from GasInfinity/zig:pthread-spin into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31990 Reviewed-by: Andrew Kelley <andrew@ziglang.org>
This commit is contained in:
+27
-1
@@ -7898,6 +7898,20 @@ pub const Stat = switch (native_os) {
|
||||
else => void,
|
||||
};
|
||||
|
||||
pub const pthread_spinlock_t = switch (native_os) {
|
||||
.openbsd => openbsd.pthread_spinlock_t,
|
||||
.freebsd => extern struct {
|
||||
inner: ?*anyopaque = null,
|
||||
},
|
||||
.netbsd => extern struct {
|
||||
pts_magic: c_uint,
|
||||
spin: pthread_spin_t,
|
||||
pts_flags: c_int,
|
||||
},
|
||||
.windows => isize,
|
||||
else => c_int,
|
||||
};
|
||||
|
||||
pub const pthread_mutex_t = switch (native_os) {
|
||||
.linux => extern struct {
|
||||
data: [data_len]u8 align(@alignOf(usize)) = [_]u8{0} ** data_len,
|
||||
@@ -10956,6 +10970,19 @@ pub extern "c" fn dn_expand(
|
||||
length: c_int,
|
||||
) c_int;
|
||||
|
||||
pub const PTHREAD_PROCESS_PRIVATE: c_int = if (native_os.isDarwin())
|
||||
2
|
||||
else
|
||||
0;
|
||||
|
||||
pub const PTHREAD_PROCESS_SHARED: c_int = 1;
|
||||
|
||||
pub extern "c" fn pthread_spin_init(spin: *pthread_spinlock_t, pshared: c_int) c_int;
|
||||
pub extern "c" fn pthread_spin_lock(spin: *pthread_spinlock_t) c_int;
|
||||
pub extern "c" fn pthread_spin_unlock(spin: *pthread_spinlock_t) c_int;
|
||||
pub extern "c" fn pthread_spin_trylock(spin: *pthread_spinlock_t) c_int;
|
||||
pub extern "c" fn pthread_spin_destroy(spin: *pthread_spinlock_t) c_int;
|
||||
|
||||
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = .{};
|
||||
pub extern "c" fn pthread_mutex_lock(mutex: *pthread_mutex_t) E;
|
||||
pub extern "c" fn pthread_mutex_unlock(mutex: *pthread_mutex_t) E;
|
||||
@@ -11268,7 +11295,6 @@ pub const login_getcaptime = openbsd.login_getcaptime;
|
||||
pub const login_getclass = openbsd.login_getclass;
|
||||
pub const login_getstyle = openbsd.login_getstyle;
|
||||
pub const pledge = openbsd.pledge;
|
||||
pub const pthread_spinlock_t = openbsd.pthread_spinlock_t;
|
||||
pub const pw_dup = openbsd.pw_dup;
|
||||
pub const setclasscontext = openbsd.setclasscontext;
|
||||
pub const setpassent = openbsd.setpassent;
|
||||
|
||||
Reference in New Issue
Block a user