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.
shutdwn(int sig)
{
struct player *p;
shutdwn(int sig)
{
struct player *p;
logerror("Shutdown commencing (cleaning up threads.)");
logerror("Shutdown commencing (cleaning up threads.)");
}
empth_wakeup(p->proc);
}
}
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
if (sig)
logerror("Server shutting down on signal %d", sig);
else