Merge pull request #229 from t-b/recompile_openssh_against_current_openssl
[msysgit.git] / include / pthread.h
blob1261ddc5f12b15d416c36d3b761813fe90d2e580
1 /* pthread.h: POSIX pthread interface
3 Copyright 1996, 1997, 1998, 1999, 20000, 2001 Red Hat, Inc.
5 Written by Marco Fuykschot <marco@ddi.nl>
7 This file is part of Cygwin.
9 This software is a copyrighted work licensed under the terms of the
10 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
11 details. */
13 #include <sys/types.h>
14 #include <signal.h>
15 #include <sched.h>
17 #ifndef _PTHREAD_H
18 #define _PTHREAD_H
20 #ifdef __cplusplus
21 extern "C"
23 #endif
26 /* Defines. (These are correctly defined here as per
27 http://www.opengroup.org/onlinepubs/7908799/xsh/pthread.h.html */
29 /* FIXME: this should allocate a new cond variable, and return the value that
30 would normally be written to the passed parameter of pthread_cond_init(lvalue, NULL); */
31 /* #define PTHREAD_COND_INITIALIZER 0 */
33 #define PTHREAD_DESTRUCTOR_ITERATIONS 1
34 /* Tls has 64 items for pre win2000 - and we don't want to use them all :]
35 * Before committing discuss this with the list
37 #define PTHREAD_KEYS_MAX 32
38 /* the default : joinable */
40 #define PTHREAD_CANCEL_ASYNCHRONOUS 1
41 /* defaults are enable, deferred */
42 #define PTHREAD_CANCEL_ENABLE 0
43 #define PTHREAD_CANCEL_DEFERRED 0
44 #define PTHREAD_CANCEL_DISABLE 1
45 #define PTHREAD_CANCELED
46 #define PTHREAD_COND_INITIALIZER
47 #define PTHREAD_CREATE_DETACHED 1
48 /* the default : joinable */
49 #define PTHREAD_CREATE_JOINABLE 0
50 #define PTHREAD_EXPLICIT_SCHED 1
51 #define PTHREAD_INHERIT_SCHED 0
52 #define PTHREAD_MUTEX_DEFAULT 0
53 #define PTHREAD_MUTEX_ERRORCHECK 1
54 #define PTHREAD_MUTEX_NORMAL 2
55 /* this should be too low to ever be a valid address */
56 #define PTHREAD_MUTEX_INITIALIZER (void *)20
57 #define PTHREAD_MUTEX_RECURSIVE 0
58 #define PTHREAD_ONCE_INIT { PTHREAD_MUTEX_INITIALIZER, 0 }
59 #define PTHREAD_PRIO_INHERIT
60 #define PTHREAD_PRIO_NONE
61 #define PTHREAD_PRIO_PROTECT
62 #define PTHREAD_PROCESS_SHARED 1
63 #define PTHREAD_PROCESS_PRIVATE 0
64 #define PTHREAD_RWLOCK_INITIALIZER
65 /* process is the default */
66 #define PTHREAD_SCOPE_PROCESS 0
67 #define PTHREAD_SCOPE_SYSTEM 1
70 /* Attributes */
71 int pthread_attr_destroy (pthread_attr_t *);
72 int pthread_attr_getdetachstate (const pthread_attr_t *, int *);
73 int pthread_attr_getinheritsched (const pthread_attr_t *, int *);
74 int pthread_attr_getschedparam (const pthread_attr_t *, struct sched_param *);
75 int pthread_attr_getschedpolicy (const pthread_attr_t *, int *);
76 int pthread_attr_getscope (const pthread_attr_t *, int *);
77 int pthread_attr_init (pthread_attr_t *);
78 int pthread_attr_setdetachstate (pthread_attr_t *, int);
79 int pthread_attr_setinheritsched (pthread_attr_t *, int);
80 int pthread_attr_setschedparam (pthread_attr_t *, const struct sched_param *);
81 int pthread_attr_setschedpolicy (pthread_attr_t *, int);
82 int pthread_attr_setscope (pthread_attr_t *, int);
84 #ifdef _POSIX_THREAD_ATTR_STACKADDR
85 /* These functions may be implementable via some low level trickery. For now they are
86 * Not supported or implemented. The prototypes are here so if someone greps the
87 * source they will see these comments
89 int pthread_attr_getstackaddr (const pthread_attr_t *, void **);
90 int pthread_attr_setstackaddr (pthread_attr_t *, void *);
91 #endif
93 #ifdef _POSIX_THREAD_ATTR_STACKSIZE
94 int pthread_attr_getstacksize (const pthread_attr_t *, size_t *);
95 int pthread_attr_setstacksize (pthread_attr_t *, size_t);
96 #endif
98 int pthread_cancel (pthread_t);
99 /* Macros for cleanup_push and pop;
100 * The function definitions are
101 void pthread_cleanup_push (void (*routine)(void*), void *arg);
102 void pthread_cleanup_pop (int execute);
104 typedef void __cleanup_routine_type (void *);
106 #define pthread_cleanup_push(fn, arg) { __cleanup_routine_type __cleanup_routine=fn; \
107 void *__cleanup_param=arg;
108 #define pthread_cleanup_pop(execute) if (execute) __cleanup_routine(__cleanup_param); }
110 /* Condition variables */
111 int pthread_cond_broadcast (pthread_cond_t *);
112 int pthread_cond_destroy (pthread_cond_t *);
113 int pthread_cond_init (pthread_cond_t *, const pthread_condattr_t *);
114 int pthread_cond_signal (pthread_cond_t *);
115 int pthread_cond_timedwait (pthread_cond_t *,
116 pthread_mutex_t *, const struct timespec *);
117 int pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *);
118 int pthread_condattr_destroy (pthread_condattr_t *);
119 int pthread_condattr_getpshared (const pthread_condattr_t *, int *);
120 int pthread_condattr_init (pthread_condattr_t *);
121 int pthread_condattr_setpshared (pthread_condattr_t *, int);
123 int pthread_create (pthread_t *, const pthread_attr_t *,
124 void *(*)(void *), void *);
125 int pthread_detach (pthread_t);
126 int pthread_equal (pthread_t, pthread_t);
127 void pthread_exit (void *);
128 int pthread_getschedparam (pthread_t, int *, struct sched_param *);
129 void *pthread_getspecific (pthread_key_t);
130 int pthread_join (pthread_t, void **);
131 int pthread_key_create (pthread_key_t *, void (*)(void *));
132 int pthread_key_delete (pthread_key_t);
134 /* Mutex's */
135 int pthread_mutex_destroy (pthread_mutex_t *);
136 int pthread_mutex_getprioceiling (const pthread_mutex_t *, int *);
137 int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *);
138 int pthread_mutex_lock (pthread_mutex_t *);
139 int pthread_mutex_setprioceiling (pthread_mutex_t *, int, int *);
140 int pthread_mutex_trylock (pthread_mutex_t *);
141 int pthread_mutex_unlock (pthread_mutex_t *);
142 int pthread_mutexattr_destroy (pthread_mutexattr_t *);
143 int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *, int *);
144 int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *, int *);
145 int pthread_mutexattr_getpshared (const pthread_mutexattr_t *, int *);
146 int pthread_mutexattr_gettype (const pthread_mutexattr_t *, int *);
147 int pthread_mutexattr_init (pthread_mutexattr_t *);
148 int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *, int);
149 int pthread_mutexattr_setprotocol (pthread_mutexattr_t *, int);
150 int pthread_mutexattr_setpshared (pthread_mutexattr_t *, int);
151 int pthread_mutexattr_settype (pthread_mutexattr_t *, int);
153 int pthread_once (pthread_once_t *, void (*)(void));
155 /* Concurrency levels - X/Open interface */
156 int pthread_getconcurrency (void);
157 int pthread_setconcurrency (int);
160 pthread_t pthread_self (void);
161 int pthread_setcancelstate (int, int *);
162 int pthread_setcanceltype (int, int *);
163 int pthread_setschedparam (pthread_t, int, const struct sched_param *);
164 int pthread_setspecific (pthread_key_t, const void *);
165 void pthread_testcancel (void);
167 /* Non posix calls */
169 int pthread_suspend (pthread_t);
170 int pthread_continue (pthread_t);
172 #ifdef __cplusplus
174 #endif
176 #endif /* _PTHREAD_H */