(PS_KILL): Nobody can observe this state, as player is deleted right

after entering it.  Remove.
(player_kill_idle, player_login): Simplify.
This commit is contained in:
Markus Armbruster 2007-01-21 12:16:54 +00:00
parent d8fbfda100
commit aaaf5bdc82
3 changed files with 5 additions and 7 deletions

View file

@ -81,7 +81,6 @@ struct player {
#define PS_LOGIN 1
#define PS_PLAYING 2
#define PS_SHUTDOWN 3
#define PS_KILL 4
/* player flags */
enum {

View file

@ -84,7 +84,8 @@ player_login(void *ud)
pr_id(player, C_INIT, "Empire server ready\n");
while (!io_eof(player->iop) && !io_error(player->iop)) {
while (!io_eof(player->iop) && !io_error(player->iop)
&& player->state != PS_SHUTDOWN) {
io_output(player->iop, IO_WAIT);
if (io_gets(player->iop, buf, sizeof(buf)) < 0) {
io_input(player->iop, IO_WAIT);
@ -107,8 +108,6 @@ player_login(void *ud)
default:
break;
}
if (player->state >= PS_SHUTDOWN)
break;
}
player->state = PS_SHUTDOWN;
if (!io_eof(player->iop)) {

View file

@ -55,9 +55,9 @@ player_kill_idle(void *unused)
/*continue; */
for (p = player_next(0); p != 0; p = player_next(p)) {
if (p->state == PS_SHUTDOWN) {
/* no more mr. nice guy */
p->state = PS_KILL;
p->aborted++;
/* player thread hung */
/* FIXME but for how long? unknown if shut down elsewhere! */
/* FIXME this can leave stale update_lock behind! */
empth_terminate(p->proc);
p = player_delete(p);
continue;