*/
empth_rwlock_t *play_lock;
-/*
- * Is a thread attempting to take an exclusive play_lock?
- * Threads holding a shared play_lock must not sleep while this is
- * true.
- */
-int play_wrlock_wanted;
-
static char pidfname[] = "server.pid";
/* Run as daemon? If yes, detach from controlling terminal etc. */
pid_t pid;
int status;
+ fflush(NULL);
pid = fork();
if (pid < 0) {
logerror("Can't fork for crash dump (%s)", strerror(errno));
return;
}
if (pid == 0)
- abort(); /* child */
+ raise(SIGABRT); /* child */
/* parent */
while (waitpid(pid, &status, 0) < 0) {
if (journal_startup() < 0)
exit(1);
- empth_create(player_accept, 50 * 1024, flags, "AcceptPlayers", 0);
+ empth_create(player_accept, 50 * 1024, flags, "AcceptPlayers", NULL);
market_init();
update_init();
logerror("Shutdown commencing (cleaning up threads.)");
- play_wrlock_wanted = 1;
- for (p = player_next(0); p != 0; p = player_next(p)) {
+ for (p = player_next(NULL); p; p = player_next(p)) {
if (p->state != PS_PLAYING)
continue;
pr_flash(p, "Server shutting down...\n");
p->state = PS_SHUTDOWN;
+ p->may_sleep = PLAYER_SLEEP_NEVER;
p->aborted++;
if (p->command) {
pr_flash(p, "Shutdown aborting command\n");