2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
15 #include <afs/errmap_nt.h>
16 #include <rx/rx_queue.h>
23 #define PTHREAD_CREATE_JOINABLE 1
24 #define PTHREAD_CREATE_DETACHED 0
30 #define PTHREAD_KEYS_MAX 32
32 typedef int pthread_condattr_t
;
33 typedef int pthread_mutexattr_t
;
34 typedef int pthread_rwlockattr_t
;
35 typedef int pthread_key_t
;
36 typedef void *pthread_t
;
38 typedef struct timespec
{
50 typedef struct cond_waiter
{
51 struct rx_queue wait_queue
;
57 struct rx_queue waiting_threads
;
61 pthread_mutex_t write_access_mutex
;
62 pthread_mutex_t read_access_completion_mutex
;
63 pthread_cond_t read_access_completion_wait
;
67 #define PTHREAD_ONCE_INIT {0,1}
69 extern int pthread_cond_broadcast(pthread_cond_t
*cond
);
70 extern int pthread_cond_destroy(pthread_cond_t
*cond
);
71 extern int pthread_cond_init(pthread_cond_t
*cond
, const pthread_condattr_t
*attr
);
72 extern int pthread_cond_signal(pthread_cond_t
*cond
);
73 extern int pthread_cond_wait(pthread_cond_t
*cond
, pthread_mutex_t
*mutex
);
74 extern int pthread_cond_timedwait(pthread_cond_t
*cond
, pthread_mutex_t
*mutex
, const struct timespec
*abstime
);
75 extern int pthread_create(pthread_t
*tid
, const pthread_attr_t
*attr
, void *(*func
)(void *), void *arg
);
76 extern void *pthread_getspecific(pthread_key_t key
);
77 extern int pthread_join(pthread_t target_thread
, void **status
);
78 extern int pthread_key_create(pthread_key_t
*keyp
, void (*destructor
)(void *value
));
79 extern int pthread_key_delete(pthread_key_t key
);
81 extern int pthread_mutex_destroy(pthread_mutex_t
*mp
);
82 extern int pthread_mutex_init(pthread_mutex_t
*mp
, const pthread_mutexattr_t
*attr
);
83 extern int pthread_mutex_lock(pthread_mutex_t
*mp
);
84 extern int pthread_mutex_trylock(pthread_mutex_t
*mp
);
85 extern int pthread_mutex_unlock(pthread_mutex_t
*mp
);
87 extern int pthread_rwlock_destroy(pthread_rwlock_t
*rwp
);
88 extern int pthread_rwlock_init(pthread_rwlock_t
*rwp
, const pthread_rwlockattr_t
*attr
);
89 extern int pthread_rwlock_rdlock(pthread_rwlock_t
*rwp
);
90 extern int pthread_rwlock_wrlock(pthread_rwlock_t
*rwp
);
91 extern int pthread_rwlock_tryrdlock(pthread_rwlock_t
*rwp
);
92 extern int pthread_rwlock_trywrlock(pthread_rwlock_t
*rwp
);
93 extern int pthread_rwlock_unlock(pthread_rwlock_t
*rwp
);
95 extern int pthread_once(pthread_once_t
*once_control
, void (*init_routine
)(void));
96 extern int pthread_setspecific(pthread_key_t key
, const void *value
);
97 extern pthread_t
pthread_self(void);
98 extern int pthread_equal(pthread_t t1
, pthread_t t2
);
99 extern int pthread_attr_destroy(pthread_attr_t
*attr
);
100 extern int pthread_attr_init(pthread_attr_t
*attr
);
101 extern int pthread_attr_getdetachstate(pthread_attr_t
*attr
, int *detachstate
);
102 extern int pthread_attr_setdetachstate(pthread_attr_t
*attr
, int detachstate
);
103 extern void pthread_exit(void *status
);