diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2012-01-18 21:12:04 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2012-01-18 21:12:04 +0100 |
commit | c492296127b55f35f4dd78ba8829b65d3a5c0740 (patch) | |
tree | 9c6675bdb918db880ac32ff5bfae3dbf4bcd004f /sql/threadpool_unix.cc | |
parent | 690931102858d7cd90e912364e0bf934a8e7436b (diff) | |
download | mariadb-git-c492296127b55f35f4dd78ba8829b65d3a5c0740.tar.gz |
ensure that lock is held, whenever active thread counter changes.
It was not the case inside listener routine.
Diffstat (limited to 'sql/threadpool_unix.cc')
-rw-r--r-- | sql/threadpool_unix.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc index d59d33c6589..d0a6b0d8a08 100644 --- a/sql/threadpool_unix.cc +++ b/sql/threadpool_unix.cc @@ -591,9 +591,7 @@ static connection_t * listener(worker_thread_t *current_thread, if (thread_group->shutdown) break; - thread_group->active_thread_count--; cnt = io_poll_wait(thread_group->pollfd, ev, MAX_EVENTS, -1); - thread_group->active_thread_count++; if (cnt <=0) { @@ -1015,11 +1013,13 @@ connection_t *get_event(worker_thread_t *current_thread, if(!thread_group->listener) { thread_group->listener= current_thread; + thread_group->active_thread_count--; mysql_mutex_unlock(&thread_group->mutex); connection = listener(current_thread, thread_group); mysql_mutex_lock(&thread_group->mutex); + thread_group->active_thread_count++; /* There is no listener anymore, it just returned. */ thread_group->listener= NULL; break; |