From 12680781696b1fbeb8134d2737495d3f2a22d935 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 14 Jan 2025 11:04:14 -0400 Subject: [PATCH] MT#55283 use auto lock Change-Id: I2ecd3c0d11701697601a5ce524b57d49e487f2da --- daemon/cookie_cache.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/daemon/cookie_cache.c b/daemon/cookie_cache.c index b3c773d2b..21646b6b8 100644 --- a/daemon/cookie_cache.c +++ b/daemon/cookie_cache.c @@ -37,7 +37,7 @@ static void __cookie_cache_check_swap(struct cookie_cache *c) { cache_entry *cookie_cache_lookup(struct cookie_cache *c, const str *s) { cache_entry *ret; - mutex_lock(&c->lock); + LOCK(&c->lock); __cookie_cache_check_swap(c); @@ -63,28 +63,25 @@ restart: // caller is required to call cookie_cache_insert or cookie_cache_remove // before `s` runs out of scope g_hash_table_replace(c->current.in_use, (void *) s, (void *) 0x1); - mutex_unlock(&c->lock); return NULL; } void cookie_cache_insert(struct cookie_cache *c, const str *s, const struct cache_entry *entry) { - mutex_lock(&c->lock); + LOCK(&c->lock); g_hash_table_remove(c->current.in_use, s); g_hash_table_remove(c->old.in_use, s); g_hash_table_replace(c->current.cookies, str_dup(s), cache_entry_dup(entry)); g_hash_table_remove(c->old.cookies, s); cond_broadcast(&c->cond); - mutex_unlock(&c->lock); } void cookie_cache_remove(struct cookie_cache *c, const str *s) { - mutex_lock(&c->lock); + LOCK(&c->lock); g_hash_table_remove(c->current.in_use, s); g_hash_table_remove(c->old.in_use, s); g_hash_table_remove(c->current.cookies, s); g_hash_table_remove(c->old.cookies, s); cond_broadcast(&c->cond); - mutex_unlock(&c->lock); } void cookie_cache_cleanup(struct cookie_cache *c) {