diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/config-win.h | 9 | ||||
-rw-r--r-- | include/my_pthread.h | 8 |
2 files changed, 8 insertions, 9 deletions
diff --git a/include/config-win.h b/include/config-win.h index 8d6f8885626..db5f516a59b 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -411,16 +411,7 @@ inline double ulonglong2double(ulonglong value) #ifdef __NT__ /* This should also work on Win98 but .. */ #define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) #define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C)) -#define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) -#else -#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_add(V,C,L) (V)+=(C) #endif -#define statistic_increment(V,L) thread_safe_increment((V),(L)) -#define statistic_decrement(V,L) thread_safe_decrement((V),(L)) #define shared_memory_buffer_length 16000 #define default_shared_memory_base_name "MYSQL" diff --git a/include/my_pthread.h b/include/my_pthread.h index ef52bbcb16c..e282d16fa12 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -722,17 +722,25 @@ extern uint thd_lib_detected; Warning: When compiling without threads, this file is not included. See the *other* declarations of thread_safe_xxx in include/my_global.h + + Second warning: + See include/config-win.h, for yet another implementation. */ #ifdef THREAD +#ifndef thread_safe_increment #define thread_safe_increment(V,L) \ (pthread_mutex_lock((L)), (V)++, pthread_mutex_unlock((L))) #define thread_safe_decrement(V,L) \ (pthread_mutex_lock((L)), (V)--, pthread_mutex_unlock((L))) +#endif + +#ifndef thread_safe_add #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))) #endif +#endif /* statistics_xxx functions are for non critical statistic, |