(dispatch): Rwlocks can hand out read locks while a write lock is
wanted. Unfair to writers, but possible. This lets commands run with !player->aborted, which can then block on input and thus let players delay the update or shutdown indefinitely. Avoid by spinning until the update is done.
This commit is contained in:
parent
bca365c485
commit
f850968883
1 changed files with 10 additions and 0 deletions
|
@ -88,6 +88,16 @@ dispatch(char *buf, char *redir)
|
|||
pr("Command not implemented\n");
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Rwlocks can hand out read locks while a write lock is wanted.
|
||||
* Unfair to writers, but possible. This lets commands run with
|
||||
* !player->aborted, which can then block on input and thus delay
|
||||
* the update indefinitely. We could avoid that by setting
|
||||
* player->aborted here, but spinning until the update is done is
|
||||
* nicer to players.
|
||||
*/
|
||||
while (play_wrlock_wanted)
|
||||
empth_yield();
|
||||
empth_rwlock_rdlock(play_lock);
|
||||
if (redir) {
|
||||
prredir(redir);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue