GNU Radio 2.x: ot_pthread_nt.h Source File

Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

# ot_pthread_nt.h

Go to the documentation of this file.

    00001 /*                              Package : omnithread
    00002    omnithread/pthread_nt.h      Created : Steven Brenneis <brennes1@rjrt.com>
    00003
    00004       Copyright (C) 1998 Steven Brennes
    00005
    00006       This file is part of the omnithread library
    00007
    00008       The omnithread library is free software; you can redistribute it and/or
    00009       modify it under the terms of the GNU Library General Public
    00010       License as published by the Free Software Foundation; either
    00011       version 2 of the License, or (at your option) any later version.
    00012
    00013       This library is distributed in the hope that it will be useful,
    00014       but WITHOUT ANY WARRANTY; without even the implied warranty of
    00015       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00016       Library General Public License for more details.
    00017
    00018       You should have received a copy of the GNU Library General Public
    00019       License along with this library; if not, write to the Free
    00020       Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    00021       02111-1307, USA
    00022
    00023       Posix Threads implementation for Windows NT, version 4.0
    00024 */
    00025
    00026 #ifndef PTHREAD_NT_H_INCLUDED
    00027 #define PTHREAD_NT_H_INCLUDED
    00028
    00029 #include <errno.h>
    00030
    00031 #ifndef ETIMEDOUT
    00032 //      May have to be changed if NT starts supporting more errno values
    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;           /* LOCK, SLOW, TYPE, RECURSIVE  */
    00064         unsigned int valid;          /* Validation info */
    00065         __pthreadLongString_t name;   /* Name of mutex */
    00066         unsigned int arg;            /* printf argument for  name */
    00067         unsigned int depth;          /* Recursive lock depth */
    00068         unsigned long sequence;       /* Mutex sequence number */
    00069         unsigned long owner;          /* Current owner (if known */
    00070         __pthreadLongAddr_t block;          /* Pointer to blocking struct */
    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;          /* EVENT, SLOW, REFCNT */
    00080         unsigned int valid;          /* Validation info */
    00081         __pthreadLongString_t name;   /* Name of condition variable */
    00082         unsigned int arg;            /* printf argument for name */
    00083         unsigned long sequence;       /* Condition variable seq # */
    00084         __pthreadLongAddr_t block;          /* Pointer to blocking struct */
    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;      /* Reserved to posix_nt */
    00094         __pthreadLongAddr_t reserved2;      /* Reserved to posix_nt */
    00095         unsigned short size;           /* Size of data structure */
    00096         unsigned char reserved3[2];   /* Reserved to posix_nt */
    00097         __pthreadLongAddr_t reserved4;   /* Reserved to posix_nt */
    00098         __pthreadLongUint_t sequence;       /* Thread sequence number */
    00099         __pthreadLongUint_t reserved5[2];   /* Reserved to posix_nt */
    00100         __pthreadLongAddr_t per_kt_area;    /* Pointer to kernel context */
    00101         __pthreadLongAddr_t stack_base;     /* Current stack base */
    00102         __pthreadLongAddr_t stack_reserve; /* Current stack reserve zone */
    00103         __pthreadLongAddr_t stack_yellow;   /* Current stack yellow zone */
    00104         __pthreadLongAddr_t stack_guard;    /* Current stack guard zone */
    00105         __pthreadLongUint_t stack_size;     /* Size of stack */
    00106         __pthreadTsd_t tsd_values;     /* TSD array (indexed by key) */
    00107         unsigned long tsd_count;      /* Number of TSD cells */
    00108         __pthreadLongAddr_t reserved6;      /* Reserved to posix_nt */
    00109         __pthreadLongAddr_t reserved7;      /* Reserved to posix_nt */
    00110         unsigned int thread_flags;   /* Dynamic external state */
    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 /*      Function Prototypes */
    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