(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_LOGIN 1
#define PS_PLAYING 2 #define PS_PLAYING 2
#define PS_SHUTDOWN 3 #define PS_SHUTDOWN 3
#define PS_KILL 4
/* player flags */ /* player flags */
enum { enum {

View file

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

View file

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