MT#55283 shorten lock duration

We can do the freeing safely after having removed the shard from the
list.

Change-Id: I15d7ec71b0c44b916571c420b07c715ad2feaf50
pull/1918/head
Richard Fuchs 9 months ago
parent 162e982088
commit ef7aa06801

@ -196,10 +196,12 @@ static struct bpool_shard *bpool_find_shard(void *p) {
}
static void bpool_shard_destroy(struct bpool_shard *shard) {
RWLOCK_W(&bpool_shards_lock);
struct bpool_shard **ele = bpool_find_shard_ptr(shard->buf);
size_t idx = (void **) ele - bpool_shards->pdata;
g_ptr_array_remove_index(bpool_shards, idx);
{
RWLOCK_W(&bpool_shards_lock);
struct bpool_shard **ele = bpool_find_shard_ptr(shard->buf);
size_t idx = (void **) ele - bpool_shards->pdata;
g_ptr_array_remove_index(bpool_shards, idx);
}
bufferpool_dealloc(shard);
g_free(shard);
}

Loading…
Cancel
Save