mirror of
https://github.com/schoebel/mars
synced 2025-02-28 10:30:39 +00:00
infra: fix silly deadlock on improbable race
This commit is contained in:
parent
fb6db64faa
commit
988457b65b
@ -451,16 +451,15 @@ struct say_channel *make_channel(const char *name, bool must_exist)
|
||||
|
||||
for (ch = channel_list; ch; ch = ch->ch_next) {
|
||||
if (ch != res && unlikely(!strcmp(ch->ch_name, name))) {
|
||||
up_write(&say_mutex);
|
||||
_del_channel(res);
|
||||
res = ch;
|
||||
goto race_found;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
res->ch_next = channel_list;
|
||||
channel_list = res;
|
||||
|
||||
race_found:
|
||||
up_write(&say_mutex);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user