(dispatch): Set player->command before acquiring play_lock, to make
sure the command is reliably aborted on update and shutdown. Before, redirection output could block while player->command was still null, letting players delay the update or shutdown indefinitely.
This commit is contained in:
parent
f850968883
commit
8fa3ba1b60
1 changed files with 2 additions and 2 deletions
|
@ -98,13 +98,13 @@ dispatch(char *buf, char *redir)
|
|||
*/
|
||||
while (play_wrlock_wanted)
|
||||
empth_yield();
|
||||
player->command = command;
|
||||
empth_rwlock_rdlock(play_lock);
|
||||
if (redir) {
|
||||
prredir(redir);
|
||||
uprnf(buf);
|
||||
pr("\n");
|
||||
}
|
||||
player->command = command;
|
||||
switch (command->c_addr()) {
|
||||
case RET_OK:
|
||||
player->btused += command->c_cost;
|
||||
|
@ -121,6 +121,6 @@ dispatch(char *buf, char *redir)
|
|||
break;
|
||||
}
|
||||
empth_rwlock_unlock(play_lock);
|
||||
player->command = 0;
|
||||
player->command = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue