summaryrefslogtreecommitdiff
path: root/assoc.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2011-10-02 01:21:52 -0700
committerdormando <dormando@rydia.net>2011-11-09 16:06:08 -0800
commit45e0e9500f11783e227898c7af66a4b5c0057f41 (patch)
treef9b623edb2f425819157a157d361dfa8f3034fde /assoc.c
parent67b6bb1d04994e638ccdae6b738e6b960af0858d (diff)
downloadmemcached-45e0e9500f11783e227898c7af66a4b5c0057f41.tar.gz
Use spinlocks for main cache lock
Partly by Ripduman Sohan Appears to significantly help prevent performance dropoff from additional threads, but only when the locks are frequently contested and are short.
Diffstat (limited to 'assoc.c')
-rw-r--r--assoc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/assoc.c b/assoc.c
index 9500b00..59cbb0f 100644
--- a/assoc.c
+++ b/assoc.c
@@ -205,7 +205,7 @@ static void *assoc_maintenance_thread(void *arg) {
/* Lock the cache, and bulk move multiple buckets to the new
* hash table. */
- pthread_mutex_lock(&cache_lock);
+ mutex_lock(&cache_lock);
for (ii = 0; ii < hash_bulk_move && expanding; ++ii) {
item *it, *next;
@@ -264,7 +264,7 @@ int start_assoc_maintenance_thread() {
}
void stop_assoc_maintenance_thread() {
- pthread_mutex_lock(&cache_lock);
+ mutex_lock(&cache_lock);
do_run_maintenance_thread = 0;
pthread_cond_signal(&maintenance_cond);
pthread_mutex_unlock(&cache_lock);