Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

my_pthread.h File Reference

#include <errno.h>
#include <pthread.h>

Go to the source code of this file.

Defines

#define ETIME   ETIMEDOUT
#define pthread_key(T, V)   pthread_key_t V
#define my_pthread_getspecific_ptr(T, V)   my_pthread_getspecific(T,(V))
#define my_pthread_setspecific_ptr(T, V)   pthread_setspecific(T,(void*) (V))
#define pthread_detach_this_thread()
#define pthread_handler_decl(A, B)   void *A(void *B)
#define my_sigwait(A, B)   sigwait((A),(B))
#define sigset(A, B)
#define pthread_attr_setscope(A, B)
#define my_pthread_getspecific(A, B)   ((A) pthread_getspecific(B))
#define pthread_key_delete(A)   pthread_dummy(0)
#define HAVE_PTHREAD_KILL
#define safe_mutex_assert_owner(mp)
#define rw_lock_t   my_rw_lock_t
#define rw_rdlock(A)   my_rw_rdlock((A))
#define rw_wrlock(A)   my_rw_wrlock((A))
#define rw_tryrdlock(A)   my_rw_tryrdlock((A))
#define rw_trywrlock(A)   my_rw_trywrlock((A))
#define rw_unlock(A)   my_rw_unlock((A))
#define rwlock_destroy(A)   my_rwlock_destroy((A))
#define GETHOSTBYADDR_BUFF_SIZE   2048
#define thr_setconcurrency(A)   pthread_dummy(0)
#define pthread_attr_setstacksize(A, B)   pthread_dummy(0)
#define MY_MUTEX_INIT_SLOW   NULL
#define MY_MUTEX_INIT_FAST   NULL
#define MY_MUTEX_INIT_ERRCHK   NULL
#define THREAD_NAME_SIZE   10
#define DEFAULT_THREAD_STACK   (192*1024)
#define my_thread_var   (_my_thread_var())
#define my_errno   my_thread_var->thr_errno
#define thread_safe_increment(V, L)   pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
#define thread_safe_add(V, C, L)   pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
#define thread_safe_sub(V, C, L)   pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
#define statistic_increment(V, L)   (V)++
#define statistic_add(V, C, L)   (V)+=(C)

Typedefs

typedef void *(* pthread_handler )(void *)
typedef st_safe_mutex_t safe_mutex_t
typedef _my_rw_lock_t my_rw_lock_t

Functions

int my_pthread_getprio (pthread_t thread_id)
int sigwait (sigset_t *setp, int *sigp)
void my_pthread_setprio (pthread_t thread_id, int prior)
void my_pthread_attr_setprio (pthread_attr_t *attr, int priority)
tm * localtime_r (const time_t *clock, struct tm *res)
tm * gmtime_r (const time_t *clock, struct tm *res)
int safe_mutex_init (safe_mutex_t *mp, const pthread_mutexattr_t *attr, const char *file, uint line)
int safe_mutex_lock (safe_mutex_t *mp, const char *file, uint line)
int safe_mutex_unlock (safe_mutex_t *mp, const char *file, uint line)
int safe_mutex_destroy (safe_mutex_t *mp, const char *file, uint line)
int safe_cond_wait (pthread_cond_t *cond, safe_mutex_t *mp, const char *file, uint line)
int safe_cond_timedwait (pthread_cond_t *cond, safe_mutex_t *mp, struct timespec *abstime, const char *file, uint line)
void safe_mutex_global_init (void)
void safe_mutex_end (FILE *file)
int my_rwlock_init (my_rw_lock_t *, void *)
int my_rwlock_destroy (my_rw_lock_t *)
int my_rw_rdlock (my_rw_lock_t *)
int my_rw_wrlock (my_rw_lock_t *)
int my_rw_unlock (my_rw_lock_t *)
int my_rw_tryrdlock (my_rw_lock_t *)
int my_rw_trywrlock (my_rw_lock_t *)
my_bool my_thread_global_init (void)
void my_thread_global_end (void)
my_bool my_thread_init (void)
void my_thread_end (void)
const char * my_thread_name (void)
long my_thread_id (void)
int pthread_no_free (void *)
int pthread_dummy (int)
st_my_thread_var_my_thread_var (void) __attribute__((const ))

Variables

pthread_t shutdown_th
pthread_t main_th
pthread_t signal_th


Define Documentation

#define DEFAULT_THREAD_STACK   (192*1024)
 

Definition at line 642 of file my_pthread.h.

#define ETIME   ETIMEDOUT
 

Definition at line 24 of file my_pthread.h.

#define GETHOSTBYADDR_BUFF_SIZE   2048
 

Definition at line 598 of file my_pthread.h.

#define HAVE_PTHREAD_KILL
 

Definition at line 446 of file my_pthread.h.

#define my_errno   my_thread_var->thr_errno
 

Definition at line 668 of file my_pthread.h.

#define MY_MUTEX_INIT_ERRCHK   NULL
 

Definition at line 619 of file my_pthread.h.

#define MY_MUTEX_INIT_FAST   NULL
 

Definition at line 613 of file my_pthread.h.

#define MY_MUTEX_INIT_SLOW   NULL
 

Definition at line 608 of file my_pthread.h.

#define my_pthread_getspecific A,
 )     ((A) pthread_getspecific(B))
 

Definition at line 374 of file my_pthread.h.

#define my_pthread_getspecific_ptr T,
 )     my_pthread_getspecific(T,(V))
 

Definition at line 262 of file my_pthread.h.

#define my_pthread_setspecific_ptr T,
 )     pthread_setspecific(T,(void*) (V))
 

Definition at line 263 of file my_pthread.h.

#define my_sigwait A,
 )     sigwait((A),(B))
 

Definition at line 307 of file my_pthread.h.

#define my_thread_var   (_my_thread_var())
 

Definition at line 667 of file my_pthread.h.

#define pthread_attr_setscope A,
 ) 
 

Definition at line 359 of file my_pthread.h.

#define pthread_attr_setstacksize A,
 )     pthread_dummy(0)
 

Definition at line 604 of file my_pthread.h.

 
#define pthread_detach_this_thread  ) 
 

Definition at line 264 of file my_pthread.h.

#define pthread_handler_decl A,
 )     void *A(void *B)
 

Definition at line 265 of file my_pthread.h.

#define pthread_key T,
 )     pthread_key_t V
 

Definition at line 261 of file my_pthread.h.

#define pthread_key_delete  )     pthread_dummy(0)
 

Definition at line 396 of file my_pthread.h.

#define rw_lock_t   my_rw_lock_t
 

Definition at line 581 of file my_pthread.h.

#define rw_rdlock  )     my_rw_rdlock((A))
 

Definition at line 582 of file my_pthread.h.

#define rw_tryrdlock  )     my_rw_tryrdlock((A))
 

Definition at line 584 of file my_pthread.h.

#define rw_trywrlock  )     my_rw_trywrlock((A))
 

Definition at line 585 of file my_pthread.h.

#define rw_unlock  )     my_rw_unlock((A))
 

Definition at line 586 of file my_pthread.h.

#define rw_wrlock  )     my_rw_wrlock((A))
 

Definition at line 583 of file my_pthread.h.

#define rwlock_destroy  )     my_rwlock_destroy((A))
 

Definition at line 587 of file my_pthread.h.

#define safe_mutex_assert_owner mp   ) 
 

Definition at line 536 of file my_pthread.h.

#define sigset A,
 ) 
 

Value:

do { struct sigaction s; sigset_t set;              \
                         sigemptyset(&set);                             \
                         s.sa_handler = (B);                            \
                         s.sa_mask    = set;                            \
                         s.sa_flags   = 0;                              \
                         sigaction((A), &s, (struct sigaction *) NULL); \
                       } while (0)

Definition at line 331 of file my_pthread.h.

#define statistic_add V,
C,
 )     (V)+=(C)
 

Definition at line 695 of file my_pthread.h.

#define statistic_increment V,
 )     (V)++
 

Definition at line 694 of file my_pthread.h.

#define thr_setconcurrency  )     pthread_dummy(0)
 

Definition at line 601 of file my_pthread.h.

#define THREAD_NAME_SIZE   10
 

Definition at line 633 of file my_pthread.h.

#define thread_safe_add V,
C,
 )     pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
 

Definition at line 685 of file my_pthread.h.

#define thread_safe_increment V,
 )     pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
 

Definition at line 683 of file my_pthread.h.

#define thread_safe_sub V,
C,
 )     pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
 

Definition at line 687 of file my_pthread.h.


Typedef Documentation

typedef struct _my_rw_lock_t my_rw_lock_t
 

typedef void*(* pthread_handler)(void *)
 

Definition at line 266 of file my_pthread.h.

typedef struct st_safe_mutex_t safe_mutex_t
 


Function Documentation

struct st_my_thread_var* _my_thread_var void   )  const
 

struct tm* gmtime_r const time_t *  clock,
struct tm *  res
 

struct tm* localtime_r const time_t *  clock,
struct tm *  res
 

void my_pthread_attr_setprio pthread_attr_t attr,
int  priority
 

int my_pthread_getprio pthread_t  thread_id  ) 
 

void my_pthread_setprio pthread_t  thread_id,
int  prior
 

int my_rw_rdlock my_rw_lock_t  ) 
 

int my_rw_tryrdlock my_rw_lock_t  ) 
 

int my_rw_trywrlock my_rw_lock_t  ) 
 

int my_rw_unlock my_rw_lock_t  ) 
 

int my_rw_wrlock my_rw_lock_t  ) 
 

int my_rwlock_destroy my_rw_lock_t  ) 
 

int my_rwlock_init my_rw_lock_t ,
void * 
 

void my_thread_end void   ) 
 

void my_thread_global_end void   ) 
 

my_bool my_thread_global_init void   ) 
 

long my_thread_id void   ) 
 

my_bool my_thread_init void   ) 
 

const char* my_thread_name void   ) 
 

int pthread_dummy int   ) 
 

int pthread_no_free void *   ) 
 

int safe_cond_timedwait pthread_cond_t cond,
safe_mutex_t mp,
struct timespec abstime,
const char *  file,
uint  line
 

int safe_cond_wait pthread_cond_t cond,
safe_mutex_t mp,
const char *  file,
uint  line
 

int safe_mutex_destroy safe_mutex_t mp,
const char *  file,
uint  line
 

void safe_mutex_end FILE *  file  ) 
 

void safe_mutex_global_init void   ) 
 

int safe_mutex_init safe_mutex_t mp,
const pthread_mutexattr_t attr,
const char *  file,
uint  line
 

int safe_mutex_lock safe_mutex_t mp,
const char *  file,
uint  line
 

int safe_mutex_unlock safe_mutex_t mp,
const char *  file,
uint  line
 

int sigwait sigset_t setp,
int *  sigp
 


Variable Documentation

pthread_t main_th
 

pthread_t shutdown_th
 

pthread_t signal_th
 


Generated on Sun May 14 14:51:28 2006 by  doxygen 1.4.2