Skip to content

Commit

Permalink
fix pthread_once usage with libc on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
kprotty committed Oct 6, 2021
1 parent 37fa674 commit d4377c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/std/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ pub extern "c" fn pthread_rwlock_trywrlock(rwl: *c.pthread_rwlock_t) callconv(.C
pub extern "c" fn pthread_rwlock_unlock(rwl: *c.pthread_rwlock_t) callconv(.C) c.E;

pub const PTHREAD_ONCE_INIT = c.pthread_once_t{};
pub extern "c" fn pthread_once(once: *c.pthread_once_t, init_routine: fn () callconv(.C) void) callconv(.C) c_int;
pub extern "c" fn pthread_once(once: *c.pthread_once_t, init_routine: fn () callconv(.C) void) callconv(.C) c.E;

pub const pthread_t = *opaque {};
pub const FILE = opaque {};
Expand Down
3 changes: 3 additions & 0 deletions lib/std/c/linux.zig
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ pub const pthread_attr_t = extern struct {
__align: c_long,
};

pub const pthread_once_t = extern struct {
__futex: c_int = 0,
};
pub const pthread_mutex_t = extern struct {
size: [__SIZEOF_PTHREAD_MUTEX_T]u8 align(@alignOf(usize)) = [_]u8{0} ** __SIZEOF_PTHREAD_MUTEX_T,
};
Expand Down

0 comments on commit d4377c0

Please sign in to comment.