diff --git a/src/lib/player/dispatch.c b/src/lib/player/dispatch.c index 22117f16..46160c03 100644 --- a/src/lib/player/dispatch.c +++ b/src/lib/player/dispatch.c @@ -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);