home: hub: hare-pthread

Download patch

ref: b1e7119f598c5375b72008f85e0bb98740ba5377
parent: 1c557dc95cee8934e942cab92e3f1c85fbf0a9c9
author: grobe0ba <grobe0ba@tcp80.org>
date: Sun May 28 22:46:52 CDT 2023

update for newer hare

--- a/fns.ha
+++ b/fns.ha
@@ -1,119 +1,119 @@
 use rt;
-export @symbol("pthread_atfork") fn atfork(_: pthreadfn, _: pthreadfn, _: pthreadfn) int;
+export @symbol("pthread_atfork") fn atfork(pthreadfn, pthreadfn, pthreadfn) int;
 
-export @symbol("pthread_attr_destroy") fn attr_destroy(_: *attr_t) int;
-export @symbol("pthread_attr_getstack") fn attr_getstack(_: *attr_t, _: nullable **void, _: *u64) int;
-export @symbol("pthread_attr_getstacksize") fn attr_getstacksize(_: const *attr_t, _: *u64) int;
-export @symbol("pthread_attr_getstackaddr") fn attr_getstackaddr(_: const *attr_t, _: *u64) int;
-export @symbol("pthread_attr_getguardsize") fn attr_getguardsize(_: const *attr_t, _: *u64) int;
-export @symbol("pthread_attr_getdetachstate") fn attr_getdetachstate(_: const *attr_t, _: *int) int;
-export @symbol("pthread_attr_init") fn attr_init(_: *attr_t) int;
-export @symbol("pthread_attr_setstacksize") fn attr_setstacksize(_: *attr_t, _: u64) int;
-export @symbol("pthread_attr_setstack") fn attr_setstack(_: *attr_t, _: nullable *void, _: *u64) int;
-export @symbol("pthread_attr_setstackaddr") fn attr_setstackaddr(_: *attr_t, _: nullable *void) int;
-export @symbol("pthread_attr_setguardsize") fn attr_setguardsize(_: *attr_t, _: u64) int;
-export @symbol("pthread_attr_setdetachstate") fn attr_setdetachstate(_: *attr_t, _: int) int;
+export @symbol("pthread_attr_destroy") fn attr_destroy(*attr_t) int;
+export @symbol("pthread_attr_getstack") fn attr_getstack(*attr_t, nullable **void, *u64) int;
+export @symbol("pthread_attr_getstacksize") fn attr_getstacksize(const *attr_t, *u64) int;
+export @symbol("pthread_attr_getstackaddr") fn attr_getstackaddr(const *attr_t, *u64) int;
+export @symbol("pthread_attr_getguardsize") fn attr_getguardsize(const *attr_t, *u64) int;
+export @symbol("pthread_attr_getdetachstate") fn attr_getdetachstate(const *attr_t, *int) int;
+export @symbol("pthread_attr_init") fn attr_init(*attr_t) int;
+export @symbol("pthread_attr_setstacksize") fn attr_setstacksize(*attr_t, u64) int;
+export @symbol("pthread_attr_setstack") fn attr_setstack(*attr_t, nullable *void, *u64) int;
+export @symbol("pthread_attr_setstackaddr") fn attr_setstackaddr(*attr_t, nullable *void) int;
+export @symbol("pthread_attr_setguardsize") fn attr_setguardsize(*attr_t, u64) int;
+export @symbol("pthread_attr_setdetachstate") fn attr_setdetachstate(*attr_t, int) int;
 
-export @symbol("pthread_cleanup_pop") fn cleanup_pop(_: int) void;
-export @symbol("pthread_cleanup_push") fn cleanup_push(_: pthreadfn, _: nullable *void) void;
+export @symbol("pthread_cleanup_pop") fn cleanup_pop(int) void;
+export @symbol("pthread_cleanup_push") fn cleanup_push(pthreadfn, nullable *void) void;
 
-export @symbol("pthread_condattr_destroy") fn condattr_destroy(_: *condattr_t) int;
-export @symbol("pthread_condattr_init") fn condattr_init(_: *condattr_t) int;
+export @symbol("pthread_condattr_destroy") fn condattr_destroy(*condattr_t) int;
+export @symbol("pthread_condattr_init") fn condattr_init(*condattr_t) int;
 
-export @symbol("pthread_cond_broadcast") fn cond_broadcast(_: *cond_t) int;
-export @symbol("pthread_cond_destroy") fn cond_destroy(_: *cond_t) int;
-export @symbol("pthread_cond_init") fn cond_init(_: *cond_t, _: const *condattr_t) int;
-export @symbol("pthread_cond_signal") fn cond_signal(_: *cond_t) int;
-export @symbol("pthread_cond_timedwait") fn cond_timedwait(_: *cond_t, _: *mutex_t, _: const *rt::timespec) int;
-export @symbol("pthread_cond_wait") fn cond_wait(_: *cond_t, _: *mutex_t) int;
+export @symbol("pthread_cond_broadcast") fn cond_broadcast(*cond_t) int;
+export @symbol("pthread_cond_destroy") fn cond_destroy(*cond_t) int;
+export @symbol("pthread_cond_init") fn cond_init(*cond_t, const *condattr_t) int;
+export @symbol("pthread_cond_signal") fn cond_signal(*cond_t) int;
+export @symbol("pthread_cond_timedwait") fn cond_timedwait(*cond_t, *mutex_t, const *rt::timespec) int;
+export @symbol("pthread_cond_wait") fn cond_wait(*cond_t, *mutex_t) int;
 
-export @symbol("pthread_create") fn create(_: *pthread_t, _: const *attr_t, _: pthreadfn, _: nullable *void) int;
-export @symbol("pthread_detach") fn detach(_: pthread_t) int;
-export @symbol("pthread_equal") fn equal(_: pthread_t, _: pthread_t) int;
-export @symbol("pthread_exit") @noreturn fn exit(_: nullable *void) void;
-export @symbol("pthread_getspecific") fn getspecific(_: key_t) nullable *void;
-export @symbol("pthread_join") fn join(_: pthread_t, _: nullable **void) int;
+export @symbol("pthread_create") fn create(*pthread_t, const *attr_t, pthreadfn, nullable *void) int;
+export @symbol("pthread_detach") fn detach(pthread_t) int;
+export @symbol("pthread_equal") fn equal(pthread_t, pthread_t) int;
+export @symbol("pthread_exit") @noreturn fn exit(nullable *void) void;
+export @symbol("pthread_getspecific") fn getspecific(key_t) nullable *void;
+export @symbol("pthread_join") fn join(pthread_t, nullable **void) int;
 
-export @symbol("pthread_key_create") fn key_create(_: *key_t, _: pthreadfn) int;
-export @symbol("pthread_key_delete") fn key_delete(_: key_t) int;
+export @symbol("pthread_key_create") fn key_create(*key_t, pthreadfn) int;
+export @symbol("pthread_key_delete") fn key_delete(key_t) int;
 
-export @symbol("pthread_kill") fn kill(_: pthread_t, _: int) int;
+export @symbol("pthread_kill") fn kill(pthread_t, int) int;
 
-export @symbol("pthread_mutexattr_init") fn mutexattr_init(_: *mutexattr_t) int;
-export @symbol("pthread_mutexattr_destroy") fn mutexattr_destroy(_: *mutexattr_t) int;
-export @symbol("pthread_mutexattr_gettype") fn mutexattr_gettype(_: *mutexattr_t, _: *int) int;
-export @symbol("pthread_mutexattr_settype") fn mutexattr_settype(_: *mutexattr_t, _: int) int;
+export @symbol("pthread_mutexattr_init") fn mutexattr_init(*mutexattr_t) int;
+export @symbol("pthread_mutexattr_destroy") fn mutexattr_destroy(*mutexattr_t) int;
+export @symbol("pthread_mutexattr_gettype") fn mutexattr_gettype(*mutexattr_t, *int) int;
+export @symbol("pthread_mutexattr_settype") fn mutexattr_settype(*mutexattr_t, int) int;
 
-export @symbol("pthread_mutex_destroy") fn mutex_destroy(_: *mutex_t) int;
-export @symbol("pthread_mutex_init") fn mutex_init(_: *mutex_t, _: const *mutexattr_t) int;
-export @symbol("pthread_mutex_lock") fn mutex_lock(_: *mutex_t) int;
-export @symbol("pthread_mutex_timedlock") fn mutex_timedlock(_: *mutex_t, _: const *rt::timespec) int;
-export @symbol("pthread_mutex_trylock") fn mutex_trylock(_: *mutex_t) int;
-export @symbol("pthread_mutex_unlock") fn mutex_unlock(_: *mutex_t) int;
+export @symbol("pthread_mutex_destroy") fn mutex_destroy(*mutex_t) int;
+export @symbol("pthread_mutex_init") fn mutex_init(*mutex_t, const *mutexattr_t) int;
+export @symbol("pthread_mutex_lock") fn mutex_lock(*mutex_t) int;
+export @symbol("pthread_mutex_timedlock") fn mutex_timedlock(*mutex_t, const *rt::timespec) int;
+export @symbol("pthread_mutex_trylock") fn mutex_trylock(*mutex_t) int;
+export @symbol("pthread_mutex_unlock") fn mutex_unlock(*mutex_t) int;
 
-export @symbol("pthread_once") fn once(_: *once_t, _: pthreadfn) int;
+export @symbol("pthread_once") fn once(*once_t, pthreadfn) int;
 
-export @symbol("pthread_rwlock_destroy") fn rwlock_destroy(_: *rwlock_t) int;
-export @symbol("pthread_rwlock_init") fn rwlock_init(_: *rwlock_t, _: const *rwlockattr_t) int;
-export @symbol("pthread_rwlock_rdlock") fn rwlock_rdlock(_: *rwlock_t) int;
-export @symbol("pthread_rwlock_timedrdlock") fn rwlock_timedrdlock(_: *rwlock_t, _: const *rt::timespec) int;
-export @symbol("pthread_rwlock_timedwrlock") fn rwlock_timedwrlock(_: *rwlock_t, _: const *rt::timespec) int;
-export @symbol("pthread_rwlock_tryrdlock") fn rwlock_tryrdlock(_: *rwlock_t) int;
-export @symbol("pthread_rwlock_trywrlock") fn rwlock_trywrlock(_: *rwlock_t) int;
-export @symbol("pthread_rwlock_unlock") fn rwlock_unlock(_: *rwlock_t) int;
-export @symbol("pthread_rwlock_wrlock") fn rwlock_wrlock(_: *rwlock_t) int;
-export @symbol("pthread_rwlockattr_init") fn rwlockattr_init(_: *rwlockattr_t) int;
-export @symbol("pthread_rwlockattr_getpshared") fn rwlockattr_getpshared(_: *rwlockattr_t, _: *int) int;
-export @symbol("pthread_rwlockattr_setpshared") fn rwlockattr_setpshared(_: *rwlockattr_t, _: *int) int;
-export @symbol("pthread_rwlockattr_destroy") fn rwlockattr_destroy(_: *rwlockattr_t) int;
+export @symbol("pthread_rwlock_destroy") fn rwlock_destroy(*rwlock_t) int;
+export @symbol("pthread_rwlock_init") fn rwlock_init(*rwlock_t, const *rwlockattr_t) int;
+export @symbol("pthread_rwlock_rdlock") fn rwlock_rdlock(*rwlock_t) int;
+export @symbol("pthread_rwlock_timedrdlock") fn rwlock_timedrdlock(*rwlock_t, const *rt::timespec) int;
+export @symbol("pthread_rwlock_timedwrlock") fn rwlock_timedwrlock(*rwlock_t, const *rt::timespec) int;
+export @symbol("pthread_rwlock_tryrdlock") fn rwlock_tryrdlock(*rwlock_t) int;
+export @symbol("pthread_rwlock_trywrlock") fn rwlock_trywrlock(*rwlock_t) int;
+export @symbol("pthread_rwlock_unlock") fn rwlock_unlock(*rwlock_t) int;
+export @symbol("pthread_rwlock_wrlock") fn rwlock_wrlock(*rwlock_t) int;
+export @symbol("pthread_rwlockattr_init") fn rwlockattr_init(*rwlockattr_t) int;
+export @symbol("pthread_rwlockattr_getpshared") fn rwlockattr_getpshared(*rwlockattr_t, *int) int;
+export @symbol("pthread_rwlockattr_setpshared") fn rwlockattr_setpshared(*rwlockattr_t, *int) int;
+export @symbol("pthread_rwlockattr_destroy") fn rwlockattr_destroy(*rwlockattr_t) int;
 
 export @symbol("pthread_self") fn self() pthread_t;
-export @symbol("pthread_setspecific") fn setspecific(_: key_t, _: nullable *void) int;
-export @symbol("pthread_cancel") fn cancel(_: pthread_t) int;
-export @symbol("pthread_setcancelstate") fn setcancelstate(_: int, _: *int) int;
-export @symbol("pthread_setcanceltype") fn setcanceltype(_: int, _: *int) int;
+export @symbol("pthread_setspecific") fn setspecific(key_t, nullable *void) int;
+export @symbol("pthread_cancel") fn cancel(pthread_t) int;
+export @symbol("pthread_setcancelstate") fn setcancelstate(int, *int) int;
+export @symbol("pthread_setcanceltype") fn setcanceltype(int, *int) int;
 export @symbol("pthread_testcancel") fn testcancel() void;
-export @symbol("pthread_getprio") fn getprio(_: pthread_t) int;
-export @symbol("pthread_setprio") fn setprio(_: pthread_t, _: int) int;
+export @symbol("pthread_getprio") fn getprio(pthread_t) int;
+export @symbol("pthread_setprio") fn setprio(pthread_t, int) int;
 
 export @symbol("pthread_pyield") fn pyield() void;
 
-export @symbol("pthread_mutexattr_getprioceiling") fn mutexattr_getprioceiling(_: *mutexattr_t, _: *int) int;
-export @symbol("pthread_mutexattr_setprioceiling") fn mutexattr_setprioceiling(_: *mutexattr_t, _: int) int;
+export @symbol("pthread_mutexattr_getprioceiling") fn mutexattr_getprioceiling(*mutexattr_t, *int) int;
+export @symbol("pthread_mutexattr_setprioceiling") fn mutexattr_setprioceiling(*mutexattr_t, int) int;
 
-export @symbol("pthread_mutex_getprioceiling") fn mutex_getprioceiling(_: *mutex_t, _: *int) int;
-export @symbol("pthread_mutex_setprioceiling") fn mutex_setprioceiling(_: *mutex_t, _: int, _: *int) int;
+export @symbol("pthread_mutex_getprioceiling") fn mutex_getprioceiling(*mutex_t, *int) int;
+export @symbol("pthread_mutex_setprioceiling") fn mutex_setprioceiling(*mutex_t, int, *int) int;
 
-export @symbol("pthread_mutexattr_getprotocol") fn mutexattr_getprotocol(_: *mutexattr_t, _: *int) int;
-export @symbol("pthread_mutexattr_setprotocol") fn mutexattr_setprotocol(_: *mutexattr_t, _: int) int;
+export @symbol("pthread_mutexattr_getprotocol") fn mutexattr_getprotocol(*mutexattr_t, *int) int;
+export @symbol("pthread_mutexattr_setprotocol") fn mutexattr_setprotocol(*mutexattr_t, int) int;
 
-export @symbol("pthread_condattr_getclock") fn condattr_getclock(_: *condattr_t, _: *clockid_t) int;
-export @symbol("pthread_condattr_setclock") fn condattr_setclock(_: *condattr_t, _: clockid_t) int;
+export @symbol("pthread_condattr_getclock") fn condattr_getclock(*condattr_t, *clockid_t) int;
+export @symbol("pthread_condattr_setclock") fn condattr_setclock(*condattr_t, clockid_t) int;
 
-export @symbol("pthread_attr_getinheritsched") fn attr_getinheritsched(_: *attr_t, _: *int) int;
-export @symbol("pthread_attr_getschedparam") fn attr_getschedparam(_: *attr_t, _: *sched_param) int;
-export @symbol("pthread_attr_getschedpolicy") fn attr_getschedpolicy(_: *attr_t, _: *int) int;
-export @symbol("pthread_attr_getscope") fn attr_getscope(_: *attr_t, _: *int) int;
-export @symbol("pthread_attr_setinheritsched") fn attr_setinheritsched(_: *attr_t, _: int) int;
-export @symbol("pthread_attr_setschedparam") fn attr_setschedparam(_: *attr_t, _: *sched_param) int;
-export @symbol("pthread_attr_setschedpolicy") fn attr_setschedpolicy(_: *attr_t, _: int) int;
-export @symbol("pthread_attr_setscope") fn attr_setscope(_: *attr_t, _: int) int;
+export @symbol("pthread_attr_getinheritsched") fn attr_getinheritsched(*attr_t, *int) int;
+export @symbol("pthread_attr_getschedparam") fn attr_getschedparam(*attr_t, *sched_param) int;
+export @symbol("pthread_attr_getschedpolicy") fn attr_getschedpolicy(*attr_t, *int) int;
+export @symbol("pthread_attr_getscope") fn attr_getscope(*attr_t, *int) int;
+export @symbol("pthread_attr_setinheritsched") fn attr_setinheritsched(*attr_t, int) int;
+export @symbol("pthread_attr_setschedparam") fn attr_setschedparam(*attr_t, *sched_param) int;
+export @symbol("pthread_attr_setschedpolicy") fn attr_setschedpolicy(*attr_t, int) int;
+export @symbol("pthread_attr_setscope") fn attr_setscope(*attr_t, int) int;
 
-export @symbol("pthread_getschedparam") fn getschedparam(_: *attr_t, _: *int, _: *sched_param) int;
-export @symbol("pthread_setschedparam") fn setschedparam(_: *attr_t, _: int, _: *sched_param) int;
+export @symbol("pthread_getschedparam") fn getschedparam(*attr_t, *int, *sched_param) int;
+export @symbol("pthread_setschedparam") fn setschedparam(*attr_t, int, *sched_param) int;
 export @symbol("pthread_getconcurrency") fn getconcurrency() int;
-export @symbol("pthread_setconcurrency") fn setconcurrency(_: int) int;
+export @symbol("pthread_setconcurrency") fn setconcurrency(int) int;
 
-export @symbol("pthread_barrier_init") fn barrier_init(_: *barrier_t, _: *barrierattr_t, _: uint) int;
-export @symbol("pthread_barrier_destroy") fn barrier_destroy(_: *barrier_t) int;
-export @symbol("pthread_barrier_wait") fn barrier_wait(_: *barrier_t) int;
-export @symbol("pthread_barrierattr_init") fn barrierattr_init(_: *barrierattr_t) int;
-export @symbol("pthread_barrierattr_destroy") fn barrierattr_destroy(_: *barrierattr_t) int;
-export @symbol("pthread_barrierattr_getpshared") fn barrierattr_getpshared(_: *barrierattr_t, _: *int) int;
-export @symbol("pthread_barrierattr_setpshared") fn barrierattr_setpshared(_: *barrierattr_t, _: int) int;
+export @symbol("pthread_barrier_init") fn barrier_init(*barrier_t, *barrierattr_t, uint) int;
+export @symbol("pthread_barrier_destroy") fn barrier_destroy(*barrier_t) int;
+export @symbol("pthread_barrier_wait") fn barrier_wait(*barrier_t) int;
+export @symbol("pthread_barrierattr_init") fn barrierattr_init(*barrierattr_t) int;
+export @symbol("pthread_barrierattr_destroy") fn barrierattr_destroy(*barrierattr_t) int;
+export @symbol("pthread_barrierattr_getpshared") fn barrierattr_getpshared(*barrierattr_t, *int) int;
+export @symbol("pthread_barrierattr_setpshared") fn barrierattr_setpshared(*barrierattr_t, int) int;
 
-export @symbol("pthread_spin_init") fn spin_init(_: *spinlock_t, _: int) int;
-export @symbol("pthread_spin_destroy") fn spin_destroy(_: *spinlock_t) int;
-export @symbol("pthread_spin_trylock") fn spin_trylock(_: *spinlock_t) int;
-export @symbol("pthread_spin_lock") fn spin_lock(_: *spinlock_t) int;
-export @symbol("pthread_spin_unlock") fn spin_unlock(_: *spinlock_t) int;
+export @symbol("pthread_spin_init") fn spin_init(*spinlock_t, int) int;
+export @symbol("pthread_spin_destroy") fn spin_destroy(*spinlock_t) int;
+export @symbol("pthread_spin_trylock") fn spin_trylock(*spinlock_t) int;
+export @symbol("pthread_spin_lock") fn spin_lock(*spinlock_t) int;
+export @symbol("pthread_spin_unlock") fn spin_unlock(*spinlock_t) int;
--- a/pthread.ha
+++ b/pthread.ha
@@ -72,7 +72,7 @@
 // Additional type definitions
 
 type addr_t = *void;
-type startroutine_t = *fn(_: *void) void;
+type startroutine_t = *fn(*void) void;
 
 // Once definitions
 export type once_t = struct{
@@ -98,7 +98,7 @@
 	Max
 };
 
-export type pthreadfn = *const fn(_: *void) nullable *void;
+export type pthreadfn = *const fn(*void) nullable *void;
 
 // From /usr/include/sched.h