00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _CF_PTHREAD_H
00020 #define _CF_PTHREAD_H
00021
00022 #define CF_LM(mutex) cf_lock_mutex(__FILE__,__LINE__,(mutex))
00023 #define CF_UM(mutex) cf_unlock_mutex(__FILE__,__LINE__,(mutex))
00025 #define CF_RW_RD(rwlock) cf_rwlock_rdlock(__FILE__,__LINE__,(rwlock))
00026 #define CF_RW_WR(rwlock) cf_rwlock_wrlock(__FILE__,__LINE__,(rwlock))
00027 #define CF_RW_UN(rwlock) cf_rwlock_unlock(__FILE__,__LINE__,(rwlock))
00032 typedef struct s_cf_mutex {
00033 u_char *name;
00034 pthread_mutex_t mutex;
00035 } t_cf_mutex;
00036
00040 typedef struct s_cf_rwlock {
00041 u_char *name;
00042 pthread_rwlock_t rwlock;
00043 } t_cf_rwlock;
00044
00050 void cf_mutex_init(const u_char *name,t_cf_mutex *mutex);
00051
00055 void cf_mutex_destroy(t_cf_mutex *mutex);
00056
00062 void cf_rwlock_init(const u_char *name,t_cf_rwlock *rwlock);
00063
00068 void cf_rwlock_destroy(t_cf_rwlock *rwlock);
00069
00076 void cf_lock_mutex(const u_char *file,const int line,t_cf_mutex *mutex);
00077
00084 void cf_unlock_mutex(const u_char *file,const int line,t_cf_mutex *mutex);
00085
00092 void cf_rwlock_rdlock(const u_char *file,const int line,t_cf_rwlock *rwlock);
00093
00100 void cf_rwlock_wrlock(const u_char *file,const int line,t_cf_rwlock *rwlock);
00101
00108 void cf_rwlock_unlock(const u_char *file,const int line,t_cf_rwlock *rwlock);
00109
00110 #endif
00111
00112