#ifndef _PTHREAD_H
#define _PTHREAD_H 1
#include <features.h>
#include <sched.h>
#include <time.h>
#include <bits/endian.h>
#include <bits/pthreadtypes.h>
#include <bits/setjmp.h>
#include <bits/wordsize.h>
#include <bits/types/struct_timespec.h>
#include <bits/types/__sigset_t.h>
#include <bits/types/struct___jmp_buf_tag.h>
#ifdef __USE_MISC
# include <bits/pthread_stack_min-dynamic.h>
#endif
enum
{
PTHREAD_CREATE_JOINABLE,
#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
PTHREAD_CREATE_DETACHED
#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
};
enum
{
PTHREAD_MUTEX_TIMED_NP,
PTHREAD_MUTEX_RECURSIVE_NP,
PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_ADAPTIVE_NP
#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
,
PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
#endif
#ifdef __USE_GNU
, PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP
#endif
};
#ifdef __USE_XOPEN2K
enum
{
PTHREAD_MUTEX_STALLED,
PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED,
PTHREAD_MUTEX_ROBUST,
PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST
};
#endif
#if defined __USE_POSIX199506 || defined __USE_UNIX98
enum
{
PTHREAD_PRIO_NONE,
PTHREAD_PRIO_INHERIT,
PTHREAD_PRIO_PROTECT
};
#endif
#define PTHREAD_MUTEX_INITIALIZER \
{ { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_TIMED_NP) } }
#ifdef __USE_GNU
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
{ { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_RECURSIVE_NP) } }
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
{ { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ERRORCHECK_NP) } }
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
{ { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ADAPTIVE_NP) } }
#endif
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
enum
{
PTHREAD_RWLOCK_PREFER_READER_NP,
PTHREAD_RWLOCK_PREFER_WRITER_NP,
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
};
# define PTHREAD_RWLOCK_INITIALIZER \
{ { __PTHREAD_RWLOCK_INITIALIZER (PTHREAD_RWLOCK_DEFAULT_NP) } }
# ifdef __USE_GNU
# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
{ { __PTHREAD_RWLOCK_INITIALIZER (PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) } }
# endif
#endif /* Unix98 or XOpen2K */
enum
{
PTHREAD_INHERIT_SCHED,
#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED
PTHREAD_EXPLICIT_SCHED
#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED
};
enum
{
PTHREAD_SCOPE_SYSTEM,
#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM
PTHREAD_SCOPE_PROCESS
#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS
};
enum
{
PTHREAD_PROCESS_PRIVATE,
#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
PTHREAD_PROCESS_SHARED
#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
};
#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } }
struct _pthread_cleanup_buffer
{
void (*__routine) (void *);
void *__arg;
int __canceltype;
struct _pthread_cleanup_buffer *__prev;
};
enum
{
PTHREAD_CANCEL_ENABLE,
#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE
PTHREAD_CANCEL_DISABLE
#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE
};
enum
{
PTHREAD_CANCEL_DEFERRED,
#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED
PTHREAD_CANCEL_ASYNCHRONOUS
#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS
};
#define PTHREAD_CANCELED ((void *) -1)
#define PTHREAD_ONCE_INIT 0
#ifdef __USE_XOPEN2K
# define PTHREAD_BARRIER_SERIAL_THREAD -1
#endif
__BEGIN_DECLS
extern int pthread_create (pthread_t *__restrict __newthread,
const pthread_attr_t *__restrict __attr,
void *(*__start_routine) (void *),
void *__restrict __arg) __THROWNL __nonnull ((1, 3));
extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
extern int pthread_join (pthread_t __th, void **__thread_return);
#ifdef __USE_GNU
extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;
# ifndef __USE_TIME_BITS64
extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return,
const struct timespec *__abstime);
extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return,
clockid_t __clockid,
const struct timespec *__abstime);
# else
# ifdef __REDIRECT
extern int __REDIRECT (pthread_timedjoin_np,
(pthread_t __th, void **__thread_return,
const struct timespec *__abstime),
__pthread_timedjoin_np64);
extern int __REDIRECT (pthread_clockjoin_np,
(pthread_t __th, void **__thread_return,
clockid_t __clockid,
const struct timespec *__abstime),
__pthread_clockjoin_np64);
# else
# define pthread_timedjoin_np __pthread_timedjoin_np64
# define pthread_clockjoin_np __pthread_clockjoin_np64
# endif
# endif
#endif
extern int pthread_detach (pthread_t __th) __THROW;
extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__));
extern int pthread_equal (pthread_t __thread1, pthread_t __thread2)
__THROW __attribute__ ((__const__));
extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1));
extern int pthread_attr_destroy (pthread_attr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
int *__detachstate)
__THROW __nonnull ((1, 2));
extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
int __detachstate)
__THROW __nonnull ((1));
extern int pthread_attr_getguardsize (const pthread_attr_t *__attr,
size_t *__guardsize)
__THROW __nonnull ((1, 2));
extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
size_t __guardsize)
__THROW __nonnull ((1));
extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
struct sched_param *__restrict __param)
__THROW __nonnull ((1, 2));
extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
const struct sched_param *__restrict
__param) __THROW __nonnull ((1, 2));
extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict
__attr, int *__restrict __policy)
__THROW __nonnull ((1, 2));
extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
__THROW __nonnull ((1));
extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict
__attr, int *__restrict __inherit)
__THROW __nonnull ((1, 2));
extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
int __inherit)
__THROW __nonnull ((1));
extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
int *__restrict __scope)
__THROW __nonnull ((1, 2));
extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
__THROW __nonnull ((1));
extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict
__attr, void **__restrict __stackaddr)
__THROW __nonnull ((1, 2)) __attribute_deprecated__;
extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
void *__stackaddr)
__THROW __nonnull ((1)) __attribute_deprecated__;
extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict
__attr, size_t *__restrict __stacksize)
__THROW __nonnull ((1, 2));
extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
size_t __stacksize)
__THROW __nonnull ((1));
#ifdef __USE_XOPEN2K
extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr,
void **__restrict __stackaddr,
size_t *__restrict __stacksize)
__THROW __nonnull ((1, 2, 3));
extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
size_t __stacksize) __THROW __nonnull ((1));
#endif
#ifdef __USE_GNU
extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
size_t __cpusetsize,
const cpu_set_t *__cpuset)
__THROW __nonnull ((1, 3));
extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr,
size_t __cpusetsize,
cpu_set_t *__cpuset)
__THROW __nonnull ((1, 3));
extern int pthread_getattr_default_np (pthread_attr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_attr_setsigmask_np (pthread_attr_t *__attr,
const __sigset_t *sigmask);
extern int pthread_attr_getsigmask_np (const pthread_attr_t *__attr,
__sigset_t *sigmask);
#define PTHREAD_ATTR_NO_SIGMASK_NP (-1)
extern int pthread_setattr_default_np (const pthread_attr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr)
__THROW __nonnull ((2));
#endif
extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
const struct sched_param *__param)
__THROW __nonnull ((3));
extern int pthread_getschedparam (pthread_t __target_thread,
int *__restrict __policy,
struct sched_param *__restrict __param)
__THROW __nonnull ((2, 3));
extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
__THROW;
#ifdef __USE_GNU
extern int pthread_getname_np (pthread_t __target_thread, char *__buf,
size_t __buflen)
__THROW __nonnull ((2));
extern int pthread_setname_np (pthread_t __target_thread, const char *__name)
__THROW __nonnull ((2));
#endif
#ifdef __USE_UNIX98
extern int pthread_getconcurrency (void) __THROW;
extern int pthread_setconcurrency (int __level) __THROW;
#endif
#ifdef __USE_GNU
extern int pthread_yield (void) __THROW;
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (pthread_yield, (void), sched_yield)
__attribute_deprecated_msg__ ("\
pthread_yield is deprecated, use sched_yield instead");
# else
# define pthread_yield sched_yield
# endif
extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize,
const cpu_set_t *__cpuset)
__THROW __nonnull ((3));
extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize,
cpu_set_t *__cpuset)
__THROW __nonnull ((3));
#endif
extern int pthread_once (pthread_once_t *__once_control,
void (*__init_routine) (void)) __nonnull ((1, 2));
extern int pthread_setcancelstate (int __state, int *__oldstate);
extern int pthread_setcanceltype (int __type, int *__oldtype);
extern int pthread_cancel (pthread_t __th);
extern void pthread_testcancel (void);
struct __cancel_jmp_buf_tag
{
__jmp_buf __cancel_jmp_buf;
int __mask_was_saved;
};
typedef struct
{
struct __cancel_jmp_buf_tag __cancel_jmp_buf[1];
void *__pad[4];
} __pthread_unwind_buf_t __attribute__ ((__aligned__));
#ifndef __cleanup_fct_attribute
# define __cleanup_fct_attribute
#endif
struct __pthread_cleanup_frame
{
void (*__cancel_routine) (void *);
void *__cancel_arg;
int __do_it;
int __cancel_type;
};
#if defined __GNUC__ && defined __EXCEPTIONS
# ifdef __cplusplus
class __pthread_cleanup_class
{
void (*__cancel_routine) (void *);
void *__cancel_arg;
int __do_it;
int __cancel_type;
public:
__pthread_cleanup_class (void (*__fct) (void *), void *__arg)
: __cancel_routine (__fct), __cancel_arg (__arg), __do_it (1) { }
~__pthread_cleanup_class () { if (__do_it) __cancel_routine (__cancel_arg); }
void __setdoit (int __newval) { __do_it = __newval; }
void __defer () { pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED,
&__cancel_type); }
void __restore () const { pthread_setcanceltype (__cancel_type, 0); }
};
# define pthread_cleanup_push(routine, arg) \
do { \
__pthread_cleanup_class __clframe (routine, arg)
# define pthread_cleanup_pop(execute) \
__clframe.__setdoit (execute); \
} while (0)
# ifdef __USE_GNU
# define pthread_cleanup_push_defer_np(routine, arg) \
do { \
__pthread_cleanup_class __clframe (routine, arg); \
__clframe.__defer ()
# define pthread_cleanup_pop_restore_np(execute) \
__clframe.__restore (); \
__clframe.__setdoit (execute); \
} while (0)
# endif
# else
__extern_inline void
__pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
{
if (__frame->__do_it)
__frame->__cancel_routine (__frame->__cancel_arg);
}
# define pthread_cleanup_push(routine, arg) \
do { \
struct __pthread_cleanup_frame __clframe \
__attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \
= { .__cancel_routine = (routine), .__cancel_arg = (arg), \
.__do_it = 1 };
# define pthread_cleanup_pop(execute) \
__clframe.__do_it = (execute); \
} while (0)
# ifdef __USE_GNU
# define pthread_cleanup_push_defer_np(routine, arg) \
do { \
struct __pthread_cleanup_frame __clframe \
__attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \
= { .__cancel_routine = (routine), .__cancel_arg = (arg), \
.__do_it = 1 }; \
(void) pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, \
&__clframe.__cancel_type)
# define pthread_cleanup_pop_restore_np(execute) \
(void) pthread_setcanceltype (__clframe.__cancel_type, NULL); \
__clframe.__do_it = (execute); \
} while (0)
# endif
# endif
#else
# define pthread_cleanup_push(routine, arg) \
do { \
__pthread_unwind_buf_t __cancel_buf; \
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \
0); \
if (__glibc_unlikely (__not_first_call)) \
{ \
__cancel_routine (__cancel_arg); \
__pthread_unwind_next (&__cancel_buf); \
/* NOTREACHED */ \
} \
\
__pthread_register_cancel (&__cancel_buf); \
do {
extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
__cleanup_fct_attribute;
# define pthread_cleanup_pop(execute) \
do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\
} while (0); \
__pthread_unregister_cancel (&__cancel_buf); \
if (execute) \
__cancel_routine (__cancel_arg); \
} while (0)
extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
__cleanup_fct_attribute;
# ifdef __USE_GNU
# define pthread_cleanup_push_defer_np(routine, arg) \
do { \
__pthread_unwind_buf_t __cancel_buf; \
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \
0); \
if (__glibc_unlikely (__not_first_call)) \
{ \
__cancel_routine (__cancel_arg); \
__pthread_unwind_next (&__cancel_buf); \
/* NOTREACHED */ \
} \
\
__pthread_register_cancel_defer (&__cancel_buf); \
do {
extern void __pthread_register_cancel_defer (__pthread_unwind_buf_t *__buf)
__cleanup_fct_attribute;
# define pthread_cleanup_pop_restore_np(execute) \
do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\
} while (0); \
__pthread_unregister_cancel_restore (&__cancel_buf); \
if (execute) \
__cancel_routine (__cancel_arg); \
} while (0)
extern void __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *__buf)
__cleanup_fct_attribute;
# endif
extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
__cleanup_fct_attribute __attribute__ ((__noreturn__))
# ifndef SHARED
__attribute__ ((__weak__))
# endif
;
#endif
#if __GNUC_PREREQ (11, 0)
extern int __REDIRECT_NTHNL (__sigsetjmp_cancel,
(struct __cancel_jmp_buf_tag __env[1],
int __savemask),
__sigsetjmp) __attribute_returns_twice__;
#else
# define __sigsetjmp_cancel(env, savemask) \
__sigsetjmp ((struct __jmp_buf_tag *) (void *) (env), (savemask))
extern int __sigsetjmp (struct __jmp_buf_tag __env[1],
int __savemask) __THROWNL;
#endif
extern int pthread_mutex_init (pthread_mutex_t *__mutex,
const pthread_mutexattr_t *__mutexattr)
__THROW __nonnull ((1));
extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
__THROW __nonnull ((1));
extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
__THROWNL __nonnull ((1));
extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
__THROWNL __nonnull ((1));
#ifdef __USE_XOPEN2K
# ifndef __USE_TIME_BITS64
extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 2));
# else
# ifdef __REDIRECT_NTHNL
extern int __REDIRECT_NTHNL (pthread_mutex_timedlock,
(pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict __abstime),
__pthread_mutex_timedlock64) __nonnull ((1, 2));
# else
# define pthread_mutex_timedlock __pthread_mutex_timedlock64
# endif
# endif
#endif
#ifdef __USE_GNU
# ifndef __USE_TIME_BITS64
extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
# else
# ifdef __REDIRECT_NTHNL
extern int __REDIRECT_NTHNL (pthread_mutex_clocklock,
(pthread_mutex_t *__restrict __mutex,
clockid_t __clockid,
const struct timespec *__restrict __abstime),
__pthread_mutex_clocklock64) __nonnull ((1, 3));
# else
# define pthread_mutex_clocklock __pthread_mutex_clocklock64
# endif
# endif
#endif
extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
__THROWNL __nonnull ((1));
extern int pthread_mutex_getprioceiling (const pthread_mutex_t *
__restrict __mutex,
int *__restrict __prioceiling)
__THROW __nonnull ((1, 2));
extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
int __prioceiling,
int *__restrict __old_ceiling)
__THROW __nonnull ((1, 3));
#ifdef __USE_XOPEN2K8
extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
__THROW __nonnull ((1));
# ifdef __USE_GNU
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (pthread_mutex_consistent_np, (pthread_mutex_t *),
pthread_mutex_consistent) __nonnull ((1))
__attribute_deprecated_msg__ ("\
pthread_mutex_consistent_np is deprecated, use pthread_mutex_consistent");
# else
# define pthread_mutex_consistent_np pthread_mutex_consistent
# endif
# endif
#endif
extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t *
__restrict __attr,
int *__restrict __pshared)
__THROW __nonnull ((1, 2));
extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
int __pshared)
__THROW __nonnull ((1));
#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict
__attr, int *__restrict __kind)
__THROW __nonnull ((1, 2));
extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
__THROW __nonnull ((1));
#endif
extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *
__restrict __attr,
int *__restrict __protocol)
__THROW __nonnull ((1, 2));
extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
int __protocol)
__THROW __nonnull ((1));
extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *
__restrict __attr,
int *__restrict __prioceiling)
__THROW __nonnull ((1, 2));
extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
int __prioceiling)
__THROW __nonnull ((1));
#ifdef __USE_XOPEN2K
extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
int *__robustness)
__THROW __nonnull ((1, 2));
# ifdef __USE_GNU
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np,
(pthread_mutexattr_t *, int *),
pthread_mutexattr_getrobust) __nonnull ((1))
__attribute_deprecated_msg__ ("\
pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust");
# else
# define pthread_mutexattr_getrobust_np pthread_mutexattr_getrobust
# endif
# endif
extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
int __robustness)
__THROW __nonnull ((1));
# ifdef __USE_GNU
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np,
(pthread_mutexattr_t *, int),
pthread_mutexattr_setrobust) __nonnull ((1))
__attribute_deprecated_msg__ ("\
pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust");
# else
# define pthread_mutexattr_setrobust_np pthread_mutexattr_setrobust
# endif
# endif
#endif
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
const pthread_rwlockattr_t *__restrict
__attr) __THROW __nonnull ((1));
extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
__THROW __nonnull ((1));
extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
# ifdef __USE_XOPEN2K
# ifndef __USE_TIME_BITS64
extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 2));
# else
# ifdef __REDIRECT_NTHNL
extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock,
(pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict __abstime),
__pthread_rwlock_timedrdlock64)
__nonnull ((1, 2));
# else
# define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock64
# endif
# endif
# endif
# ifdef __USE_GNU
# ifndef __USE_TIME_BITS64
extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
# else
# ifdef __REDIRECT_NTHNL
extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock,
(pthread_rwlock_t *__restrict __rwlock,
clockid_t __clockid,
const struct timespec *__restrict __abstime),
__pthread_rwlock_clockrdlock64)
__nonnull ((1, 3));
# else
# define pthread_rwlock_clockrdlock __pthread_rwlock_clockrdlock64
# endif
# endif
# endif
extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
# ifdef __USE_XOPEN2K
# ifndef __USE_TIME_BITS64
extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 2));
# else
# ifdef __REDIRECT_NTHNL
extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock,
(pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict __abstime),
__pthread_rwlock_timedwrlock64)
__nonnull ((1, 2));
# else
# define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock64
# endif
# endif
# endif
# ifdef __USE_GNU
# ifndef __USE_TIME_BITS64
extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
# else
# ifdef __REDIRECT_NTHNL
extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock,
(pthread_rwlock_t *__restrict __rwlock,
clockid_t __clockid,
const struct timespec *__restrict __abstime),
__pthread_rwlock_clockwrlock64)
__nonnull ((1, 3));
# else
# define pthread_rwlock_clockwrlock __pthread_rwlock_clockwrlock64
# endif
# endif
# endif
extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *
__restrict __attr,
int *__restrict __pshared)
__THROW __nonnull ((1, 2));
extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
int __pshared)
__THROW __nonnull ((1));
extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
__restrict __attr,
int *__restrict __pref)
__THROW __nonnull ((1, 2));
extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
int __pref) __THROW __nonnull ((1));
#endif
extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
const pthread_condattr_t *__restrict __cond_attr)
__THROW __nonnull ((1));
extern int pthread_cond_destroy (pthread_cond_t *__cond)
__THROW __nonnull ((1));
extern int pthread_cond_signal (pthread_cond_t *__cond)
__THROWNL __nonnull ((1));
extern int pthread_cond_broadcast (pthread_cond_t *__cond)
__THROWNL __nonnull ((1));
extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex)
__nonnull ((1, 2));
# ifndef __USE_TIME_BITS64
extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict __abstime)
__nonnull ((1, 2, 3));
# else
# ifdef __REDIRECT
extern int __REDIRECT (pthread_cond_timedwait,
(pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict __abstime),
__pthread_cond_timedwait64)
__nonnull ((1, 2, 3));
# else
# define pthread_cond_timedwait __pthread_cond_timedwait64
# endif
# endif
# ifdef __USE_GNU
# ifndef __USE_TIME_BITS64
extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
__clockid_t __clock_id,
const struct timespec *__restrict __abstime)
__nonnull ((1, 2, 4));
# else
# ifdef __REDIRECT
extern int __REDIRECT (pthread_cond_clockwait,
(pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
__clockid_t __clock_id,
const struct timespec *__restrict __abstime),
__pthread_cond_clockwait64)
__nonnull ((1, 2, 4));
# else
# define pthread_cond_clockwait __pthread_cond_clockwait64
# endif
# endif
# endif
extern int pthread_condattr_init (pthread_condattr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_condattr_getpshared (const pthread_condattr_t *
__restrict __attr,
int *__restrict __pshared)
__THROW __nonnull ((1, 2));
extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
int __pshared) __THROW __nonnull ((1));
#ifdef __USE_XOPEN2K
extern int pthread_condattr_getclock (const pthread_condattr_t *
__restrict __attr,
__clockid_t *__restrict __clock_id)
__THROW __nonnull ((1, 2));
extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
__clockid_t __clock_id)
__THROW __nonnull ((1));
#endif
#ifdef __USE_XOPEN2K
extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
__THROW __nonnull ((1));
extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
__THROW __nonnull ((1));
extern int pthread_spin_lock (pthread_spinlock_t *__lock)
__THROWNL __nonnull ((1));
extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
__THROWNL __nonnull ((1));
extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
__THROWNL __nonnull ((1));
extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
const pthread_barrierattr_t *__restrict
__attr, unsigned int __count)
__THROW __nonnull ((1));
extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
__THROW __nonnull ((1));
extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
__THROWNL __nonnull ((1));
extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
__THROW __nonnull ((1));
extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *
__restrict __attr,
int *__restrict __pshared)
__THROW __nonnull ((1, 2));
extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
int __pshared)
__THROW __nonnull ((1));
#endif
extern int pthread_key_create (pthread_key_t *__key,
void (*__destr_function) (void *))
__THROW __nonnull ((1));
extern int pthread_key_delete (pthread_key_t __key) __THROW;
extern void *pthread_getspecific (pthread_key_t __key) __THROW;
extern int pthread_setspecific (pthread_key_t __key,
const void *__pointer)
__THROW __attr_access_none (2);
#ifdef __USE_XOPEN2K
extern int pthread_getcpuclockid (pthread_t __thread_id,
__clockid_t *__clock_id)
__THROW __nonnull ((2));
#endif
extern int pthread_atfork (void (*__prepare) (void),
void (*__parent) (void),
void (*__child) (void)) __THROW;
#ifdef __USE_EXTERN_INLINES
__extern_inline int
__NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2))
{
return __thread1 == __thread2;
}
#endif
__END_DECLS
#endif /* pthread.h */