1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Backported my_atomic from 6.0-codebase and added support for 64-bit atomics to enable removal of LOCK_thread_count from every query, removed LOCK_thread_count from use in dispatch_command and close of query which is used in every query, now uses atomic increments/decrements instead

This commit is contained in:
Mikael Ronstrom
2009-10-12 11:00:39 +02:00
parent 6e4f01fa8b
commit c4ce446f19
13 changed files with 337 additions and 167 deletions

View File

@@ -132,9 +132,10 @@ post_init_event_thread(THD *thd)
pthread_mutex_lock(&LOCK_thread_count);
threads.append(thd);
thread_count++;
thread_running++;
pthread_mutex_unlock(&LOCK_thread_count);
my_atomic_rwlock_wrlock(&global_query_id_lock);
inc_thread_running();
my_atomic_rwlock_wrunlock(&global_query_id_lock);
return FALSE;
}
@@ -156,10 +157,12 @@ deinit_event_thread(THD *thd)
DBUG_PRINT("exit", ("Event thread finishing"));
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
thread_running--;
delete thd;
pthread_cond_broadcast(&COND_thread_count);
pthread_mutex_unlock(&LOCK_thread_count);
my_atomic_rwlock_wrlock(&global_query_id_lock);
dec_thread_running();
my_atomic_rwlock_wrunlock(&global_query_id_lock);
}
@@ -417,10 +420,12 @@ Event_scheduler::start()
net_end(&new_thd->net);
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
thread_running--;
delete new_thd;
pthread_cond_broadcast(&COND_thread_count);
pthread_mutex_unlock(&LOCK_thread_count);
my_atomic_rwlock_wrlock(&global_query_id_lock);
dec_thread_running();
my_atomic_rwlock_wrunlock(&global_query_id_lock);
}
end:
UNLOCK_DATA();
@@ -550,10 +555,12 @@ error:
net_end(&new_thd->net);
pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
thread_running--;
delete new_thd;
pthread_cond_broadcast(&COND_thread_count);
pthread_mutex_unlock(&LOCK_thread_count);
my_atomic_rwlock_wrlock(&global_query_id_lock);
dec_thread_running();
my_atomic_rwlock_wrunlock(&global_query_id_lock);
}
delete event_name;
DBUG_RETURN(TRUE);