From 8fa3ba1b60005e0c723f3e285242719febb7ceb2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 22 Jul 2007 17:23:34 +0000 Subject: [PATCH] (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. --- src/lib/player/dispatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/player/dispatch.c b/src/lib/player/dispatch.c index 46160c03..967a58d1 100644 --- a/src/lib/player/dispatch.c +++ b/src/lib/player/dispatch.c @@ -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; }