diff --git a/include/config-win.h b/include/config-win.h index 8d6f888562640376033e355fad30966a6d7a07f8..db5f516a59b8b2e9da3c4e126f8b226a2fa0ed06 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 ef52bbcb16ca244f0a344867415cae9d153af17d..e282d16fa12fb9d934e52730ae89ea4347e5357a 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, diff --git a/sql/event_queue.cc b/sql/event_queue.cc index 40cb9040eef2a31123038a470881a0f43e524218..6cf5da383ea94c4b63b80c04caf813320526cf44 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -73,16 +73,14 @@ Event_queue::Event_queue() :next_activation_at(0), mutex_last_locked_at_line(0), mutex_last_unlocked_at_line(0), + mutex_last_attempted_lock_at_line(0), mutex_last_locked_in_func("n/a"), mutex_last_unlocked_in_func("n/a"), mutex_last_attempted_lock_in_func("n/a"), - mutex_last_attempted_lock_at_line(0), mutex_queue_data_locked(FALSE), - mutex_queue_data_attempting_lock(FALSE) + mutex_queue_data_attempting_lock(FALSE), + waiting_on_cond(FALSE) { - mutex_last_unlocked_in_func= mutex_last_locked_in_func= - mutex_last_attempted_lock_in_func= ""; - pthread_mutex_init(&LOCK_event_queue, MY_MUTEX_INIT_FAST); pthread_cond_init(&COND_queue_state, NULL); } diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 306e9db8cae80f31b809ff9016ee02b2ed7614b7..53224cccc2d7b2f1cdb19ac4d19cc683e326d2ac 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -16080,7 +16080,6 @@ static void test_bug24179() static void test_bug28075() { int rc; - MYSQL_STMT *stmt; DBUG_ENTER("test_bug28075"); myheader("test_bug28075");