diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-05-20 12:04:32 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-06-23 09:54:36 +0400 |
commit | 84568c296520f399da23f260151a7512393eb03b (patch) | |
tree | 7af56defe9644a430c38c83fb962f4180fd08424 /sql/my_apc.cc | |
parent | 0357791e3c291c47fe128954dac45c271f721b2a (diff) | |
download | mariadb-git-84568c296520f399da23f260151a7512393eb03b.tar.gz |
MDEV-8030 - Apc_target::disable() locks mutex twice
Moved Apc_target::destroy(), Apc_target::enable() and Apc_targe::disable()
definitions to my_apc.h so that they can be inlined.
Apc_targe::disable() now calls Apc_target::process_apc_requests() only if
there're APC requests. This saves one pthread_mutex_lock() call.
Overhead change:
Apc_target::disable 0.04% -> out of radar
Apc_target::enable 0.03% -> out of radar
Apc_target::process_apc_requests 0.02% -> out of radar
pthread_mutex_lock 0.43% -> 0.42%
pthread_mutex_unlock 0.26% -> 0.25%
Diffstat (limited to 'sql/my_apc.cc')
-rw-r--r-- | sql/my_apc.cc | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/sql/my_apc.cc b/sql/my_apc.cc index 17660688be0..91f5cd3f39c 100644 --- a/sql/my_apc.cc +++ b/sql/my_apc.cc @@ -41,45 +41,6 @@ void Apc_target::init(mysql_mutex_t *target_mutex) } -/* - Destroy the target. The target must be disabled when this call is made. -*/ -void Apc_target::destroy() -{ - DBUG_ASSERT(!enabled); -} - - -/* - Enter ther state where the target is available for serving APC requests -*/ -void Apc_target::enable() -{ - /* Ok to do without getting/releasing the mutex: */ - enabled++; -} - - -/* - Make the target unavailable for serving APC requests. - - @note - This call will serve all requests that were already enqueued -*/ - -void Apc_target::disable() -{ - bool process= FALSE; - DBUG_ASSERT(enabled); - mysql_mutex_lock(LOCK_thd_data_ptr); - if (!(--enabled)) - process= TRUE; - mysql_mutex_unlock(LOCK_thd_data_ptr); - if (process) - process_apc_requests(); -} - - /* [internal] Put request qe into the request list */ void Apc_target::enqueue_request(Call_request *qe) |