00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "mutex.h"
00018
00019
00020 FastMutex::FastMutex()
00021 {
00022 #if USE_PRIVATE__PTHREADS
00023 pthread_mutexattr_t attr;
00024 pthread_mutexattr_init(&attr);
00025 pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_FAST_NP);
00026 pthread_mutex_init(&m,&attr);
00027 pthread_mutexattr_destroy(&attr);
00028 #else
00029 g_static_mutex_init(&m);
00030 #endif
00031 }
00032
00033
00034 RecursiveMutex::RecursiveMutex()
00035 {
00036 #if USE_PRIVATE__PTHREADS
00037 pthread_mutexattr_t attr;
00038 pthread_mutexattr_init(&attr);
00039 pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE_NP);
00040 pthread_mutex_init(&m,&attr);
00041 pthread_mutexattr_destroy(&attr);
00042 #else
00043 g_static_rec_mutex_init(&m);
00044 #endif
00045 }