(shutdwn): Take exclusive update lock for shutdown. This makes the

shutdown block until all aborted commands terminated and gave up their
lock.  Remove the cheesy one second wait for commands to finish.  This
also locks out further commands to execute during shutdown.  However,
it also makes it impossible to kill hung player threads here.  Rely on
player_kill_idle() for that.  That doesn't quite work right now,
because it leaves a stale shared lock behind, which blocks shutdown.
This commit is contained in:
Markus Armbruster 2007-01-21 12:04:16 +00:00
parent e8f74e0f7e
commit d8fbfda100

View file

@ -366,7 +366,6 @@ void
shutdwn(int sig)
{
struct player *p;
time_t now;
logerror("Shutdown commencing (cleaning up threads.)");
@ -381,16 +380,8 @@ shutdwn(int sig)
}
empth_wakeup(p->proc);
}
time(&now);
empth_sleep(now + 1);
for (p = player_next(0); p != 0; p = player_next(p)) {
p->state = PS_KILL;
p->aborted++;
empth_terminate(p->proc);
p = player_delete(p);
}
empth_rwlock_wrlock(update_lock);
/* rely on player_kill_idle() for killing hung player threads */
if (sig)
logerror("Server shutting down on signal %d", sig);
else