From 45e0e9500f11783e227898c7af66a4b5c0057f41 Mon Sep 17 00:00:00 2001 From: dormando Date: Sun, 2 Oct 2011 01:21:52 -0700 Subject: 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. --- assoc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'assoc.c') 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); -- cgit v1.2.1