1*b688a211Skamil /* $NetBSD: pthread.h,v 1.41 2018/02/20 05:10:51 kamil Exp $ */ 2c62a74e6Sthorpej 3c62a74e6Sthorpej /*- 4c62a74e6Sthorpej * Copyright (c) 2001 The NetBSD Foundation, Inc. 5c62a74e6Sthorpej * All rights reserved. 6c62a74e6Sthorpej * 7c62a74e6Sthorpej * This code is derived from software contributed to The NetBSD Foundation 8c62a74e6Sthorpej * by Nathan J. Williams. 9c62a74e6Sthorpej * 10c62a74e6Sthorpej * Redistribution and use in source and binary forms, with or without 11c62a74e6Sthorpej * modification, are permitted provided that the following conditions 12c62a74e6Sthorpej * are met: 13c62a74e6Sthorpej * 1. Redistributions of source code must retain the above copyright 14c62a74e6Sthorpej * notice, this list of conditions and the following disclaimer. 15c62a74e6Sthorpej * 2. Redistributions in binary form must reproduce the above copyright 16c62a74e6Sthorpej * notice, this list of conditions and the following disclaimer in the 17c62a74e6Sthorpej * documentation and/or other materials provided with the distribution. 18c62a74e6Sthorpej * 19c62a74e6Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20c62a74e6Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21c62a74e6Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22c62a74e6Sthorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23c62a74e6Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24c62a74e6Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25c62a74e6Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26c62a74e6Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27c62a74e6Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28c62a74e6Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29c62a74e6Sthorpej * POSSIBILITY OF SUCH DAMAGE. 30c62a74e6Sthorpej */ 31c62a74e6Sthorpej 32c62a74e6Sthorpej #ifndef _LIB_PTHREAD_H 33c62a74e6Sthorpej #define _LIB_PTHREAD_H 34c62a74e6Sthorpej 35c62a74e6Sthorpej #include <sys/cdefs.h> 36c62a74e6Sthorpej 37c62a74e6Sthorpej #include <time.h> /* For timespec */ 38c62a74e6Sthorpej #include <sched.h> 3919884cbfSchristos #include <sys/featuretest.h> 40c62a74e6Sthorpej 4198e8a6d1Slukem #include <pthread_types.h> 42c62a74e6Sthorpej 43c62a74e6Sthorpej __BEGIN_DECLS 4479b049afSchristos #ifndef __PTHREAD_ATFORK_DECLARED 4579b049afSchristos #define __PTHREAD_ATFORK_DECLARED 464fb740b8Snathanw int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); 4779b049afSchristos #endif 489cf9c231Skleink int pthread_create(pthread_t * __restrict, 499cf9c231Skleink const pthread_attr_t * __restrict, void *(*)(void *), 509cf9c231Skleink void * __restrict); 511b36c15fSchristos void pthread_exit(void *) __attribute__((__noreturn__)); 521b36c15fSchristos int pthread_join(pthread_t, void **); 531b36c15fSchristos int pthread_equal(pthread_t, pthread_t); 54c62a74e6Sthorpej pthread_t pthread_self(void); 551b36c15fSchristos int pthread_detach(pthread_t); 56c62a74e6Sthorpej 57c62a74e6Sthorpej int pthread_getrrtimer_np(void); 58c62a74e6Sthorpej int pthread_setrrtimer_np(int); 59c62a74e6Sthorpej 601b36c15fSchristos int pthread_attr_init(pthread_attr_t *); 611b36c15fSchristos int pthread_attr_destroy(pthread_attr_t *); 62067fa34eSnathanw int pthread_attr_get_np(pthread_t, pthread_attr_t *); 639cf9c231Skleink int pthread_attr_getguardsize(const pthread_attr_t * __restrict, 649cf9c231Skleink size_t * __restrict); 65067fa34eSnathanw int pthread_attr_setguardsize(pthread_attr_t *, size_t); 669cf9c231Skleink int pthread_attr_getinheritsched(const pthread_attr_t * __restrict, 679cf9c231Skleink int * __restrict); 68067fa34eSnathanw int pthread_attr_setinheritsched(pthread_attr_t *, int); 699cf9c231Skleink int pthread_attr_getschedparam(const pthread_attr_t * __restrict, 709cf9c231Skleink struct sched_param * __restrict); 719cf9c231Skleink int pthread_attr_setschedparam(pthread_attr_t * __restrict, 729cf9c231Skleink const struct sched_param * __restrict); 739cf9c231Skleink int pthread_attr_getschedpolicy(const pthread_attr_t * __restrict, 749cf9c231Skleink int * __restrict); 75fae5965cSnathanw int pthread_attr_setschedpolicy(pthread_attr_t *, int); 769cf9c231Skleink int pthread_attr_getscope(const pthread_attr_t * __restrict, 779cf9c231Skleink int * __restrict); 78067fa34eSnathanw int pthread_attr_setscope(pthread_attr_t *, int); 799cf9c231Skleink int pthread_attr_getstack(const pthread_attr_t * __restrict, 809cf9c231Skleink void ** __restrict, size_t * __restrict); 81067fa34eSnathanw int pthread_attr_setstack(pthread_attr_t *, void *, size_t); 829cf9c231Skleink int pthread_attr_getstacksize(const pthread_attr_t * __restrict, 839cf9c231Skleink size_t * __restrict); 84067fa34eSnathanw int pthread_attr_setstacksize(pthread_attr_t *, size_t); 859cf9c231Skleink int pthread_attr_getstackaddr(const pthread_attr_t * __restrict, 869cf9c231Skleink void ** __restrict); 87067fa34eSnathanw int pthread_attr_setstackaddr(pthread_attr_t *, void *); 881b36c15fSchristos int pthread_attr_getdetachstate(const pthread_attr_t *, int *); 891b36c15fSchristos int pthread_attr_setdetachstate(pthread_attr_t *, int); 90b33971b9Sthorpej int pthread_attr_getname_np(const pthread_attr_t *, char *, 91b33971b9Sthorpej size_t, void **); 92b33971b9Sthorpej int pthread_attr_setname_np(pthread_attr_t *, const char *, void *); 93c62a74e6Sthorpej 949cf9c231Skleink int pthread_mutex_init(pthread_mutex_t * __restrict, 959cf9c231Skleink const pthread_mutexattr_t * __restrict); 961b36c15fSchristos int pthread_mutex_destroy(pthread_mutex_t *); 971b36c15fSchristos int pthread_mutex_lock(pthread_mutex_t *); 981b36c15fSchristos int pthread_mutex_trylock(pthread_mutex_t *); 991b36c15fSchristos int pthread_mutex_unlock(pthread_mutex_t *); 10041808a78Schristos #ifndef __LIBC12_SOURCE__ 1015c1cf631Skamil int pthread_mutex_timedlock(pthread_mutex_t * __restrict, 102774674fdSchristos const struct timespec * __restrict); 10341808a78Schristos #endif 104774674fdSchristos int pthread_mutex_getprioceiling(const pthread_mutex_t * __restrict, 105774674fdSchristos int * __restrict); 106774674fdSchristos int pthread_mutex_setprioceiling(pthread_mutex_t * __restrict, int, 107774674fdSchristos int * __restrict); 1081b36c15fSchristos int pthread_mutexattr_init(pthread_mutexattr_t *); 1091b36c15fSchristos int pthread_mutexattr_destroy(pthread_mutexattr_t *); 110774674fdSchristos #ifdef _PTHREAD_PSHARED 111774674fdSchristos int pthread_mutexattr_getpshared(const pthread_mutexattr_t * __restrict, 112774674fdSchristos int * __restrict); 113774674fdSchristos int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); 114774674fdSchristos #endif 1159cf9c231Skleink int pthread_mutexattr_gettype(const pthread_mutexattr_t * __restrict, 1169cf9c231Skleink int * __restrict); 117d44e858cSwiz int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int); 118774674fdSchristos int pthread_mutexattr_getprotocol(const pthread_mutexattr_t * __restrict, 119774674fdSchristos int * __restrict); 120774674fdSchristos int pthread_mutexattr_setprotocol(pthread_mutexattr_t*, 121774674fdSchristos int); 122774674fdSchristos int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t * __restrict, 123774674fdSchristos int * __restrict); 124774674fdSchristos int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, 125774674fdSchristos int); 1269cf9c231Skleink int pthread_cond_init(pthread_cond_t * __restrict, 1279cf9c231Skleink const pthread_condattr_t * __restrict); 1281b36c15fSchristos int pthread_cond_destroy(pthread_cond_t *); 1299cf9c231Skleink int pthread_cond_wait(pthread_cond_t * __restrict, 1309cf9c231Skleink pthread_mutex_t * __restrict); 131461a86f9Schristos #ifndef __LIBC12_SOURCE__ 1329cf9c231Skleink int pthread_cond_timedwait(pthread_cond_t * __restrict, 1339cf9c231Skleink pthread_mutex_t * __restrict, const struct timespec * __restrict); 134461a86f9Schristos #endif 1351b36c15fSchristos int pthread_cond_signal(pthread_cond_t *); 1361b36c15fSchristos int pthread_cond_broadcast(pthread_cond_t *); 1371b36c15fSchristos int pthread_condattr_init(pthread_condattr_t *); 1386a1ffad8Schristos int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); 139774674fdSchristos int pthread_condattr_getclock(const pthread_condattr_t * __restrict, 140774674fdSchristos clockid_t * __restrict); 1411b36c15fSchristos int pthread_condattr_destroy(pthread_condattr_t *); 142774674fdSchristos #ifdef _PTHREAD_PSHARED 143774674fdSchristos int pthread_condattr_getpshared(const pthread_condattr_t * __restrict, 144774674fdSchristos int * __restrict); 145774674fdSchristos int pthread_condattr_setpshared(pthread_condattr_t *, int); 146774674fdSchristos #endif 1471b36c15fSchristos int pthread_once(pthread_once_t *, void (*)(void)); 148c62a74e6Sthorpej 1491b36c15fSchristos int pthread_key_create(pthread_key_t *, void (*)(void *)); 1501b36c15fSchristos int pthread_key_delete(pthread_key_t); 1511b36c15fSchristos int pthread_setspecific(pthread_key_t, const void *); 1521b36c15fSchristos void* pthread_getspecific(pthread_key_t); 153c62a74e6Sthorpej 1541b36c15fSchristos int pthread_cancel(pthread_t); 1551b36c15fSchristos int pthread_setcancelstate(int, int *); 1561b36c15fSchristos int pthread_setcanceltype(int, int *); 157c62a74e6Sthorpej void pthread_testcancel(void); 158c62a74e6Sthorpej 159b33971b9Sthorpej int pthread_getname_np(pthread_t, char *, size_t); 160b33971b9Sthorpej int pthread_setname_np(pthread_t, const char *, void *); 161b33971b9Sthorpej 16238b1c6f4Schristos int pthread_attr_setcreatesuspend_np(pthread_attr_t *); 16338b1c6f4Schristos int pthread_suspend_np(pthread_t); 16438b1c6f4Schristos int pthread_resume_np(pthread_t); 16538b1c6f4Schristos 1664084ca7fSad unsigned int pthread_curcpu_np(void); 1674084ca7fSad 168efd306a0Schristos int pthread_getcpuclockid(pthread_t, clockid_t *); 169efd306a0Schristos 170c62a74e6Sthorpej struct pthread_cleanup_store { 171c62a74e6Sthorpej void *pad[4]; 172c62a74e6Sthorpej }; 173c62a74e6Sthorpej 174c62a74e6Sthorpej #define pthread_cleanup_push(routine, arg) \ 175c62a74e6Sthorpej { \ 176c62a74e6Sthorpej struct pthread_cleanup_store __store; \ 177c62a74e6Sthorpej pthread__cleanup_push((routine),(arg), &__store); 178c62a74e6Sthorpej 179c62a74e6Sthorpej #define pthread_cleanup_pop(execute) \ 180c62a74e6Sthorpej pthread__cleanup_pop((execute), &__store); \ 181c62a74e6Sthorpej } 182c62a74e6Sthorpej 1831b36c15fSchristos void pthread__cleanup_push(void (*)(void *), void *, void *); 1841b36c15fSchristos void pthread__cleanup_pop(int, void *); 185c62a74e6Sthorpej 1861b36c15fSchristos int pthread_spin_init(pthread_spinlock_t *, int); 1871b36c15fSchristos int pthread_spin_destroy(pthread_spinlock_t *); 1881b36c15fSchristos int pthread_spin_lock(pthread_spinlock_t *); 1891b36c15fSchristos int pthread_spin_trylock(pthread_spinlock_t *); 1901b36c15fSchristos int pthread_spin_unlock(pthread_spinlock_t *); 191c62a74e6Sthorpej 1929cf9c231Skleink int pthread_rwlock_init(pthread_rwlock_t * __restrict, 1939cf9c231Skleink const pthread_rwlockattr_t * __restrict); 1941b36c15fSchristos int pthread_rwlock_destroy(pthread_rwlock_t *); 1951b36c15fSchristos int pthread_rwlock_rdlock(pthread_rwlock_t *); 1961b36c15fSchristos int pthread_rwlock_tryrdlock(pthread_rwlock_t *); 1971b36c15fSchristos int pthread_rwlock_wrlock(pthread_rwlock_t *); 1981b36c15fSchristos int pthread_rwlock_trywrlock(pthread_rwlock_t *); 199461a86f9Schristos #ifndef __LIBC12_SOURCE__ 2009cf9c231Skleink int pthread_rwlock_timedrdlock(pthread_rwlock_t * __restrict, 2019cf9c231Skleink const struct timespec * __restrict); 2029cf9c231Skleink int pthread_rwlock_timedwrlock(pthread_rwlock_t * __restrict, 2039cf9c231Skleink const struct timespec * __restrict); 204461a86f9Schristos #endif 2051b36c15fSchristos int pthread_rwlock_unlock(pthread_rwlock_t *); 2061b36c15fSchristos int pthread_rwlockattr_init(pthread_rwlockattr_t *); 2071b36c15fSchristos int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); 208774674fdSchristos #ifdef _PTHREAD_PSHARED 209774674fdSchristos int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * __restrict, 210774674fdSchristos int * __restrict); 211774674fdSchristos int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); 212774674fdSchristos #endif 2139cf9c231Skleink int pthread_barrier_init(pthread_barrier_t * __restrict, 2149cf9c231Skleink const pthread_barrierattr_t * __restrict, unsigned int); 2151b36c15fSchristos int pthread_barrier_wait(pthread_barrier_t *); 2161b36c15fSchristos int pthread_barrier_destroy(pthread_barrier_t *); 2171b36c15fSchristos int pthread_barrierattr_init(pthread_barrierattr_t *); 2181b36c15fSchristos int pthread_barrierattr_destroy(pthread_barrierattr_t *); 219774674fdSchristos #ifdef _PTHREAD_PSHARED 220774674fdSchristos int pthread_barrierattr_getpshared(const pthread_barrierattr_t * __restrict, 221774674fdSchristos int * __restrict); 222774674fdSchristos int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); 223774674fdSchristos #endif 2249cf9c231Skleink int pthread_getschedparam(pthread_t, int * __restrict, 2259cf9c231Skleink struct sched_param * __restrict); 2261edf98ecSchristos int pthread_setschedparam(pthread_t, int, const struct sched_param *); 2275c71a4d4Srmind int pthread_setschedprio(pthread_t, int); 2281edf98ecSchristos 229c62a74e6Sthorpej int *pthread__errno(void); 230989565f8Sad 231989565f8Sad #if defined(_NETBSD_SOURCE) 232b5e9adddSrmind int pthread_getaffinity_np(pthread_t, size_t, cpuset_t *); 233b5e9adddSrmind int pthread_setaffinity_np(pthread_t, size_t, cpuset_t *); 23432d8a489Schristos int pthread_getattr_np(pthread_t, pthread_attr_t *); 235b5e9adddSrmind 236989565f8Sad int pthread_mutex_held_np(pthread_mutex_t *); 237989565f8Sad pthread_t pthread_mutex_owner_np(pthread_mutex_t *); 238989565f8Sad 239989565f8Sad int pthread_rwlock_held_np(pthread_rwlock_t *); 240989565f8Sad int pthread_rwlock_wrheld_np(pthread_rwlock_t *); 241989565f8Sad int pthread_rwlock_rdheld_np(pthread_rwlock_t *); 2426ebb8696Spooka 2436ebb8696Spooka int pthread_cond_has_waiters_np(pthread_cond_t *); 244989565f8Sad #endif /* _NETBSD_SOURCE */ 245989565f8Sad 246c62a74e6Sthorpej __END_DECLS 247c62a74e6Sthorpej 248c62a74e6Sthorpej #define PTHREAD_CREATE_JOINABLE 0 249c62a74e6Sthorpej #define PTHREAD_CREATE_DETACHED 1 250c62a74e6Sthorpej 251067fa34eSnathanw #define PTHREAD_INHERIT_SCHED 0 252067fa34eSnathanw #define PTHREAD_EXPLICIT_SCHED 1 253067fa34eSnathanw 254067fa34eSnathanw #define PTHREAD_SCOPE_PROCESS 0 255067fa34eSnathanw #define PTHREAD_SCOPE_SYSTEM 1 256067fa34eSnathanw 257c62a74e6Sthorpej #define PTHREAD_PROCESS_PRIVATE 0 258c62a74e6Sthorpej #define PTHREAD_PROCESS_SHARED 1 259c62a74e6Sthorpej 260c62a74e6Sthorpej #define PTHREAD_CANCEL_DEFERRED 0 261c62a74e6Sthorpej #define PTHREAD_CANCEL_ASYNCHRONOUS 1 262c62a74e6Sthorpej 263c62a74e6Sthorpej #define PTHREAD_CANCEL_ENABLE 0 264c62a74e6Sthorpej #define PTHREAD_CANCEL_DISABLE 1 265c62a74e6Sthorpej 266c62a74e6Sthorpej #define PTHREAD_BARRIER_SERIAL_THREAD 1234567 267c62a74e6Sthorpej 268c62a74e6Sthorpej /* 269c62a74e6Sthorpej * POSIX 1003.1-2001, section 2.5.9.3: "The symbolic constant 270c62a74e6Sthorpej * PTHREAD_CANCELED expands to a constant expression of type (void *) 271c62a74e6Sthorpej * whose value matches no pointer to an object in memory nor the value 272c62a74e6Sthorpej * NULL." 273c62a74e6Sthorpej */ 274c62a74e6Sthorpej #define PTHREAD_CANCELED ((void *) 1) 275c62a74e6Sthorpej 276c62a74e6Sthorpej /* 277b33971b9Sthorpej * Maximum length of a thread's name, including the terminating NUL. 278b33971b9Sthorpej */ 279b33971b9Sthorpej #define PTHREAD_MAX_NAMELEN_NP 32 280b33971b9Sthorpej 281b33971b9Sthorpej /* 282c62a74e6Sthorpej * Mutex attributes. 283c62a74e6Sthorpej */ 284c62a74e6Sthorpej #define PTHREAD_MUTEX_NORMAL 0 285c62a74e6Sthorpej #define PTHREAD_MUTEX_ERRORCHECK 1 286c62a74e6Sthorpej #define PTHREAD_MUTEX_RECURSIVE 2 287c62a74e6Sthorpej #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL 288c62a74e6Sthorpej 289774674fdSchristos #define PTHREAD_PRIO_NONE 0 290774674fdSchristos #define PTHREAD_PRIO_INHERIT 1 291774674fdSchristos #define PTHREAD_PRIO_PROTECT 2 292774674fdSchristos 293d686fc0dSnathanw #define PTHREAD_COND_INITIALIZER _PTHREAD_COND_INITIALIZER 294d686fc0dSnathanw #define PTHREAD_MUTEX_INITIALIZER _PTHREAD_MUTEX_INITIALIZER 295d686fc0dSnathanw #define PTHREAD_ONCE_INIT _PTHREAD_ONCE_INIT 296d686fc0dSnathanw #define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_RWLOCK_INITIALIZER 297d686fc0dSnathanw #define PTHREAD_SPINLOCK_INITIALIZER _PTHREAD_SPINLOCK_INITIALIZER 298d686fc0dSnathanw 2990eaa8971Snathanw /* 3000eaa8971Snathanw * Use macros to rename many pthread functions to the corresponding 3010eaa8971Snathanw * libc symbols which are either trivial/no-op stubs or the real 3020eaa8971Snathanw * thing, depending on whether libpthread is linked in to the 3030eaa8971Snathanw * program. This permits code, particularly libraries that do not 3040eaa8971Snathanw * directly use threads but want to be thread-safe in the presence of 3050eaa8971Snathanw * threaded callers, to use pthread mutexes and the like without 3060eaa8971Snathanw * unnecessairly including libpthread in their linkage. 3070eaa8971Snathanw * 3080eaa8971Snathanw * Left out of this list are functions that can't sensibly be trivial 3090eaa8971Snathanw * or no-op stubs in a single-threaded process (pthread_create, 3100eaa8971Snathanw * pthread_kill, pthread_detach), functions that normally block and 311480a2816Snathanw * wait for another thread to do something (pthread_join), and 312480a2816Snathanw * functions that don't make sense without the previous functions 313480a2816Snathanw * (pthread_attr_*). The pthread_cond_wait and pthread_cond_timedwait 314480a2816Snathanw * functions are useful in implementing certain protection mechanisms, 315dd4b29f9Swiz * though a non-buggy app shouldn't end up calling them in 316480a2816Snathanw * single-threaded mode. 3170eaa8971Snathanw * 3180eaa8971Snathanw * The rename is done as: 3190eaa8971Snathanw * #define pthread_foo __libc_foo 3200eaa8971Snathanw * instead of 3210eaa8971Snathanw * #define pthread_foo(x) __libc_foo((x)) 3220eaa8971Snathanw * in order that taking the address of the function ("func = 3230eaa8971Snathanw * &pthread_foo;") continue to work. 3240eaa8971Snathanw * 3250eaa8971Snathanw * POSIX/SUSv3 requires that its functions exist as functions (even if 3260eaa8971Snathanw * macro versions exist) and specifically that "#undef pthread_foo" is 3270eaa8971Snathanw * legal and should not break anything. Code that does such will not 3280eaa8971Snathanw * successfully get the stub behavior implemented here and will 3290eaa8971Snathanw * require libpthread to be linked in. 3300eaa8971Snathanw */ 3310eaa8971Snathanw 3320eaa8971Snathanw #ifndef __LIBPTHREAD_SOURCE__ 3330eaa8971Snathanw __BEGIN_DECLS 3349cf9c231Skleink int __libc_mutex_init(pthread_mutex_t * __restrict, const pthread_mutexattr_t * __restrict); 3350eaa8971Snathanw int __libc_mutex_lock(pthread_mutex_t *); 3360eaa8971Snathanw int __libc_mutex_trylock(pthread_mutex_t *); 3370eaa8971Snathanw int __libc_mutex_unlock(pthread_mutex_t *); 3380eaa8971Snathanw int __libc_mutex_destroy(pthread_mutex_t *); 3390eaa8971Snathanw 3400eaa8971Snathanw int __libc_mutexattr_init(pthread_mutexattr_t *); 3410eaa8971Snathanw int __libc_mutexattr_settype(pthread_mutexattr_t *, int); 3420eaa8971Snathanw int __libc_mutexattr_destroy(pthread_mutexattr_t *); 3430eaa8971Snathanw __END_DECLS 3440eaa8971Snathanw 3450eaa8971Snathanw #define pthread_mutex_init __libc_mutex_init 3460eaa8971Snathanw #define pthread_mutex_lock __libc_mutex_lock 3470eaa8971Snathanw #define pthread_mutex_trylock __libc_mutex_trylock 3480eaa8971Snathanw #define pthread_mutex_unlock __libc_mutex_unlock 3490eaa8971Snathanw #define pthread_mutex_destroy __libc_mutex_destroy 3500eaa8971Snathanw 3510eaa8971Snathanw #define pthread_mutexattr_init __libc_mutexattr_init 3520eaa8971Snathanw #define pthread_mutexattr_settype __libc_mutexattr_settype 3530eaa8971Snathanw #define pthread_mutexattr_destroy __libc_mutexattr_destroy 3540eaa8971Snathanw 3550eaa8971Snathanw __BEGIN_DECLS 3569cf9c231Skleink int __libc_cond_init(pthread_cond_t * __restrict, 3579cf9c231Skleink const pthread_condattr_t * __restrict); 3580eaa8971Snathanw int __libc_cond_signal(pthread_cond_t *); 3590eaa8971Snathanw int __libc_cond_broadcast(pthread_cond_t *); 3609cf9c231Skleink int __libc_cond_wait(pthread_cond_t * __restrict, 3619cf9c231Skleink pthread_mutex_t * __restrict); 362461a86f9Schristos #ifndef __LIBC12_SOURCE__ 3639cf9c231Skleink int __libc_cond_timedwait(pthread_cond_t * __restrict, 3649cf9c231Skleink pthread_mutex_t * __restrict, const struct timespec * __restrict); 365461a86f9Schristos #endif 3660eaa8971Snathanw int __libc_cond_destroy(pthread_cond_t *); 3670eaa8971Snathanw __END_DECLS 3680eaa8971Snathanw 3690eaa8971Snathanw #define pthread_cond_init __libc_cond_init 3700eaa8971Snathanw #define pthread_cond_signal __libc_cond_signal 3710eaa8971Snathanw #define pthread_cond_broadcast __libc_cond_broadcast 372480a2816Snathanw #define pthread_cond_wait __libc_cond_wait 373480a2816Snathanw #define pthread_cond_timedwait __libc_cond_timedwait 3740eaa8971Snathanw #define pthread_cond_destroy __libc_cond_destroy 3750eaa8971Snathanw 3760eaa8971Snathanw __BEGIN_DECLS 3779cf9c231Skleink int __libc_rwlock_init(pthread_rwlock_t * __restrict, 3789cf9c231Skleink const pthread_rwlockattr_t * __restrict); 3790eaa8971Snathanw int __libc_rwlock_rdlock(pthread_rwlock_t *); 3800eaa8971Snathanw int __libc_rwlock_wrlock(pthread_rwlock_t *); 3810eaa8971Snathanw int __libc_rwlock_tryrdlock(pthread_rwlock_t *); 3820eaa8971Snathanw int __libc_rwlock_trywrlock(pthread_rwlock_t *); 3830eaa8971Snathanw int __libc_rwlock_unlock(pthread_rwlock_t *); 3840eaa8971Snathanw int __libc_rwlock_destroy(pthread_rwlock_t *); 3850eaa8971Snathanw __END_DECLS 3860eaa8971Snathanw 3870eaa8971Snathanw #define pthread_rwlock_init __libc_rwlock_init 3880eaa8971Snathanw #define pthread_rwlock_rdlock __libc_rwlock_rdlock 3890eaa8971Snathanw #define pthread_rwlock_wrlock __libc_rwlock_wrlock 3900eaa8971Snathanw #define pthread_rwlock_tryrdlock __libc_rwlock_tryrdlock 3910eaa8971Snathanw #define pthread_rwlock_trywrlock __libc_rwlock_trywrlock 3920eaa8971Snathanw #define pthread_rwlock_unlock __libc_rwlock_unlock 3930eaa8971Snathanw #define pthread_rwlock_destroy __libc_rwlock_destroy 3940eaa8971Snathanw 3950eaa8971Snathanw __BEGIN_DECLS 3960eaa8971Snathanw int __libc_thr_keycreate(pthread_key_t *, void (*)(void *)); 3970eaa8971Snathanw int __libc_thr_setspecific(pthread_key_t, const void *); 3980eaa8971Snathanw void *__libc_thr_getspecific(pthread_key_t); 3990eaa8971Snathanw int __libc_thr_keydelete(pthread_key_t); 4000eaa8971Snathanw __END_DECLS 4010eaa8971Snathanw 4020eaa8971Snathanw #define pthread_key_create __libc_thr_keycreate 4030eaa8971Snathanw #define pthread_setspecific __libc_thr_setspecific 4040eaa8971Snathanw #define pthread_getspecific __libc_thr_getspecific 4050eaa8971Snathanw #define pthread_key_delete __libc_thr_keydelete 4060eaa8971Snathanw 4070eaa8971Snathanw __BEGIN_DECLS 4080eaa8971Snathanw int __libc_thr_once(pthread_once_t *, void (*)(void)); 4090eaa8971Snathanw pthread_t __libc_thr_self(void); 4100eaa8971Snathanw void __libc_thr_exit(void *) __attribute__((__noreturn__)); 4110eaa8971Snathanw int __libc_thr_setcancelstate(int, int *); 412095b25e7Sdrochner int __libc_thr_equal(pthread_t, pthread_t); 4134084ca7fSad unsigned int __libc_thr_curcpu(void); 4140eaa8971Snathanw __END_DECLS 4150eaa8971Snathanw 4160eaa8971Snathanw #define pthread_once __libc_thr_once 4170eaa8971Snathanw #define pthread_self __libc_thr_self 4180eaa8971Snathanw #define pthread_exit __libc_thr_exit 4190eaa8971Snathanw #define pthread_setcancelstate __libc_thr_setcancelstate 420095b25e7Sdrochner #define pthread_equal __libc_thr_equal 4214084ca7fSad #define pthread_curcpu_np __libc_thr_curcpu 4220eaa8971Snathanw 4230eaa8971Snathanw #endif /* __LIBPTHREAD_SOURCE__ */ 4240eaa8971Snathanw 425c62a74e6Sthorpej #endif /* _LIB_PTHREAD_H */ 426