summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2012-07-30 13:31:14 -0700
committerdormando <dormando@rydia.net>2012-07-30 13:31:14 -0700
commit890dfb75ed40e59bf3e46904431a5c27824e0b7e (patch)
treec25a85a4f0cebbf9c2058d90b07b253fd0c6f697
parent67c90606ee65b0e4606a4a76ace2f56d618220f6 (diff)
downloadmemcached-890dfb75ed40e59bf3e46904431a5c27824e0b7e.tar.gz
call mutex_unlock() when we use mutex_lock()1.4.14
use both #define's when using the spinlock version of our locks. not all locks are designed to be that way, so this doesn't touch the whole thing.
-rw-r--r--assoc.c4
-rw-r--r--items.c18
-rw-r--r--memcached.c2
-rw-r--r--thread.c14
4 files changed, 19 insertions, 19 deletions
diff --git a/assoc.c b/assoc.c
index 3530a62..bcaf6f2 100644
--- a/assoc.c
+++ b/assoc.c
@@ -235,7 +235,7 @@ static void *assoc_maintenance_thread(void *arg) {
pthread_cond_wait(&maintenance_cond, &cache_lock);
}
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
}
return NULL;
}
@@ -263,7 +263,7 @@ void stop_assoc_maintenance_thread() {
mutex_lock(&cache_lock);
do_run_maintenance_thread = 0;
pthread_cond_signal(&maintenance_cond);
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
/* Wait for the maintenance thread to stop */
pthread_join(maintenance_tid, NULL);
diff --git a/items.c b/items.c
index 6546f88..84011c4 100644
--- a/items.c
+++ b/items.c
@@ -44,7 +44,7 @@ static unsigned int sizes[LARGEST_ID];
void item_stats_reset(void) {
mutex_lock(&cache_lock);
memset(itemstats, 0, sizeof(itemstats));
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
}
@@ -125,7 +125,7 @@ item *do_item_alloc(char *key, const size_t nkey, const int flags, const rel_tim
} else if ((it = slabs_alloc(ntotal, id)) == NULL) {
if (settings.evict_to_free == 0) {
itemstats[id].outofmemory++;
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
return NULL;
}
itemstats[id].evicted++;
@@ -181,7 +181,7 @@ item *do_item_alloc(char *key, const size_t nkey, const int flags, const rel_tim
search->refcount = 1;
do_item_unlink_nolock(search, hash(ITEM_key(search), search->nkey, 0));
}
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
return NULL;
}
@@ -192,7 +192,7 @@ item *do_item_alloc(char *key, const size_t nkey, const int flags, const rel_tim
* been removed from the slab LRU.
*/
it->refcount = 1; /* the caller will have a reference */
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
it->next = it->prev = it->h_next = 0;
it->slabs_clsid = id;
@@ -298,7 +298,7 @@ int do_item_link(item *it, const uint32_t hv) {
assoc_insert(it, hv);
item_link_q(it);
refcount_incr(&it->refcount);
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
return 1;
}
@@ -316,7 +316,7 @@ void do_item_unlink(item *it, const uint32_t hv) {
item_unlink_q(it);
do_item_remove(it);
}
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
}
/* FIXME: Is it necessary to keep this copy/pasted code? */
@@ -354,7 +354,7 @@ void do_item_update(item *it) {
it->time = current_time;
item_link_q(it);
}
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
}
}
@@ -413,7 +413,7 @@ void item_stats_evictions(uint64_t *evicted) {
for (i = 0; i < LARGEST_ID; i++) {
evicted[i] = itemstats[i].evicted;
}
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
}
void do_item_stats(ADD_STAT add_stats, void *c) {
@@ -505,7 +505,7 @@ item *do_item_get(const char *key, const size_t nkey, const uint32_t hv) {
it = NULL;
}
}
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
int was_found = 0;
if (settings.verbose > 2) {
diff --git a/memcached.c b/memcached.c
index e3ca9ff..2cb0b20 100644
--- a/memcached.c
+++ b/memcached.c
@@ -3118,7 +3118,7 @@ enum delta_result_type do_add_delta(conn *c, const char *key, const size_t nkey,
need to update the CAS on the existing item. */
mutex_lock(&cache_lock); /* FIXME */
ITEM_set_cas(it, (settings.use_cas) ? get_cas_id() : 0);
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
memcpy(ITEM_data(it), buf, res);
memset(ITEM_data(it) + res, ' ', it->nbytes - res - 2);
diff --git a/thread.c b/thread.c
index a539dd6..f4bbe1e 100644
--- a/thread.c
+++ b/thread.c
@@ -88,7 +88,7 @@ unsigned short refcount_incr(unsigned short *refcount) {
mutex_lock(&atomics_mutex);
(*refcount)++;
res = *refcount;
- pthread_mutex_unlock(&atomics_mutex);
+ mutex_unlock(&atomics_mutex);
return res;
#endif
}
@@ -103,7 +103,7 @@ unsigned short refcount_decr(unsigned short *refcount) {
mutex_lock(&atomics_mutex);
(*refcount)--;
res = *refcount;
- pthread_mutex_unlock(&atomics_mutex);
+ mutex_unlock(&atomics_mutex);
return res;
#endif
}
@@ -113,7 +113,7 @@ void item_lock(uint32_t hv) {
}
void item_unlock(uint32_t hv) {
- pthread_mutex_unlock(&item_locks[hv & item_lock_mask]);
+ mutex_unlock(&item_locks[hv & item_lock_mask]);
}
/*
@@ -505,7 +505,7 @@ enum store_item_type store_item(item *item, int comm, conn* c) {
void item_flush_expired() {
mutex_lock(&cache_lock);
do_item_flush_expired();
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
}
/*
@@ -516,7 +516,7 @@ char *item_cachedump(unsigned int slabs_clsid, unsigned int limit, unsigned int
mutex_lock(&cache_lock);
ret = do_item_cachedump(slabs_clsid, limit, bytes);
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
return ret;
}
@@ -526,7 +526,7 @@ char *item_cachedump(unsigned int slabs_clsid, unsigned int limit, unsigned int
void item_stats(ADD_STAT add_stats, void *c) {
mutex_lock(&cache_lock);
do_item_stats(add_stats, c);
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
}
/*
@@ -535,7 +535,7 @@ void item_stats(ADD_STAT add_stats, void *c) {
void item_stats_sizes(ADD_STAT add_stats, void *c) {
mutex_lock(&cache_lock);
do_item_stats_sizes(add_stats, c);
- pthread_mutex_unlock(&cache_lock);
+ mutex_unlock(&cache_lock);
}
/******************************* GLOBAL STATS ******************************/