add pthread_key functions

This commit is contained in:
Sébastien Marie 2021-01-12 05:39:46 +00:00
parent 8ea2b40e5f
commit ebf2a7e9b9
2 changed files with 5 additions and 0 deletions

View File

@ -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;

View File

@ -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 {};