00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef PTHREAD_NT_H_INCLUDED
00027 #define PTHREAD_NT_H_INCLUDED
00028
00029 #include <errno.h>
00030
00031 #ifndef ETIMEDOUT
00032
00033 #define ETIMEDOUT 60
00034 #endif
00035
00036 #undef PthreadDraftVersion
00037 #define PthreadDraftVersion 10
00038
00039 #define NoNanoSleep
00040
00041 #define PthreadSupportThreadPriority
00042
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046
00047 #ifndef _TIMERS_T_
00048 #define _TIMERS_T_
00049 typedef struct timespec {
00050 unsigned long tv_sec;
00051 long tv_nsec;
00052 } timespec_t;
00053 #endif
00054
00055 typedef char* __pthreadLongString_t;
00056 typedef void* __pthreadLongAddr_t;
00057 typedef __pthreadLongAddr_t* __pthreadLongAddr_p;
00058 typedef long __pthreadLongInt_t;
00059 typedef unsigned long __pthreadLongUint_t;
00060 typedef __pthreadLongAddr_p __pthreadTsd_t;
00061
00062 typedef struct __pthread_mutex_t {
00063 unsigned int lock;
00064 unsigned int valid;
00065 __pthreadLongString_t name;
00066 unsigned int arg;
00067 unsigned int depth;
00068 unsigned long sequence;
00069 unsigned long owner;
00070 __pthreadLongAddr_t block;
00071 } pthread_mutex_t;
00072
00073 typedef struct __pthread_mutexattr_t {
00074 long valid;
00075 __pthreadLongUint_t reserved[15];
00076 } pthread_mutexattr_t;
00077
00078 typedef struct __pthread_cond_t {
00079 unsigned int state;
00080 unsigned int valid;
00081 __pthreadLongString_t name;
00082 unsigned int arg;
00083 unsigned long sequence;
00084 __pthreadLongAddr_t block;
00085 } pthread_cond_t ;
00086
00087 typedef struct __pthread_condattr_t {
00088 long valid;
00089 __pthreadLongUint_t reserved[13];
00090 } pthread_condattr_t ;
00091
00092 typedef struct __pthread_transp_t {
00093 __pthreadLongAddr_t reserved1;
00094 __pthreadLongAddr_t reserved2;
00095 unsigned short size;
00096 unsigned char reserved3[2];
00097 __pthreadLongAddr_t reserved4;
00098 __pthreadLongUint_t sequence;
00099 __pthreadLongUint_t reserved5[2];
00100 __pthreadLongAddr_t per_kt_area;
00101 __pthreadLongAddr_t stack_base;
00102 __pthreadLongAddr_t stack_reserve;
00103 __pthreadLongAddr_t stack_yellow;
00104 __pthreadLongAddr_t stack_guard;
00105 __pthreadLongUint_t stack_size;
00106 __pthreadTsd_t tsd_values;
00107 unsigned long tsd_count;
00108 __pthreadLongAddr_t reserved6;
00109 __pthreadLongAddr_t reserved7;
00110 unsigned int thread_flags;
00111 } pthread_transp_t, *pthread_transp_p;
00112
00113 typedef pthread_transp_p pthread_t;
00114
00115 typedef struct __pthread_attr_t {
00116 long valid;
00117 __pthreadLongString_t name;
00118 __pthreadLongUint_t arg;
00119 __pthreadLongUint_t reserved[19];
00120 } pthread_attr_t ;
00121
00122 typedef unsigned int pthread_key_t;
00123
00124 typedef struct sched_param {
00125 int sched_priority;
00126 } sched_param_t;
00127
00128
00129
00130 int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
00131 void *(*start_routine)(void*), void *arg);
00132 int pthread_detach(pthread_t thread);
00133 int pthread_join(pthread_t thread, void **value_ptr);
00134 void pthread_exit(void *value_ptr);
00135 int pthread_attr_init(pthread_attr_t *attr);
00136 int pthread_attr_destroy(pthread_attr_t *attr);
00137 int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
00138 int pthread_attr_getstacksize(const pthread_attr_t *attr,
00139 size_t *stacksize);
00140 int pthread_cond_init(pthread_cond_t *cond,
00141 const pthread_condattr_t *attr);
00142 int pthread_cond_destroy(pthread_cond_t *cond);
00143 int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
00144 int pthread_cond_timedwait(pthread_cond_t *cond,
00145 pthread_mutex_t *mutex,
00146 const struct timespec *abstime);
00147 int pthread_cond_signal(pthread_cond_t *cond);
00148 int pthread_cond_broadcast(pthread_cond_t *cond);
00149 int pthread_key_create(pthread_key_t *key, void (*destructor)(void*));
00150 int pthread_key_delete(pthread_key_t key);
00151 int pthread_mutex_destroy(pthread_mutex_t *mutex);
00152 int pthread_mutex_init(pthread_mutex_t *mutex,
00153 const pthread_mutexattr_t *attr);
00154 int pthread_mutex_lock(pthread_mutex_t *mutex);
00155 int pthread_mutex_trylock(pthread_mutex_t *mutex);
00156 int pthread_mutex_unlock(pthread_mutex_t *mutex);
00157 pthread_t pthread_self();
00158 int pthread_setspecific(pthread_key_t key, const void *value);
00159 void *pthread_getspecific(pthread_key_t key);
00160 int pthread_getschedparam(pthread_t thread, int *policy,
00161 struct sched_param *param);
00162 int pthread_setschedparam(pthread_t thread, int policy,
00163 const struct sched_param *param);
00164 int pthread_attr_setschedparam(pthread_attr_t *attr,
00165 const struct sched_param *param);
00166 int pthread_attr_getschedparam(const pthread_attr_t *attr,
00167 struct sched_param *param);
00168
00169 int pthread_delay_np(const struct timespec *interval);
00170 int pthread_get_expiration_np(const struct timespec *delta,
00171 struct timespec *abstime);
00172
00173 # define SCHED_FIFO 1
00174 # define SCHED_RR 2
00175 # define SCHED_OTHER 3
00176
00177 int sched_yield();
00178 int sched_get_priority_max(int policy);
00179 int sched_get_priority_min(int policy);
00180
00181
00182 #ifdef __cplusplus
00183 }
00184 #endif
00185
00186 #endif // PTHREAD_NT_H_INCLUDED