-deadlock then it can deadlock with a later processes that access the database.
/*
* This file is part of DisOrder
/*
* This file is part of DisOrder
- * Copyright (C) 2005, 2006, 2007 Richard Kettlewell
+ * Copyright (C) 2005-2008 Richard Kettlewell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
if((err = trackdb_env->close(trackdb_env, 0)))
fatal(0, "trackdb_env->close: %s", db_strerror(err));
if((err = trackdb_env->close(trackdb_env, 0)))
fatal(0, "trackdb_env->close: %s", db_strerror(err));
- if(rescan_pid != -1 && kill(rescan_pid, SIGTERM) < 0)
- fatal(errno, "error killing rescanner");
+ if(rescan_pid != -1) {
+ /* shut down the rescanner */
+ if(kill(rescan_pid, SIGTERM) < 0)
+ fatal(errno, "error killing rescanner");
+ /* wait for the rescanner to finish */
+ while(waitpid(rescan_pid, &err, 0) == -1 && errno == EINTR)
+ ;
+ }
+
+ /* TODO kill any stats subprocesses */
- /* terminate the deadlock manager */
+ /* finally terminate the deadlock manager */
if(db_deadlock_pid != -1 && kill(db_deadlock_pid, SIGTERM) < 0)
fatal(errno, "error killing deadlock manager");
db_deadlock_pid = -1;
if(db_deadlock_pid != -1 && kill(db_deadlock_pid, SIGTERM) < 0)
fatal(errno, "error killing deadlock manager");
db_deadlock_pid = -1;
/*
* This file is part of DisOrder
/*
* This file is part of DisOrder
- * Copyright (C) 2005, 2006, 2007 Richard Kettlewell
+ * Copyright (C) 2005-2008 Richard Kettlewell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static int current_listen_fd;
void quit(ev_source *ev) {
static int current_listen_fd;
void quit(ev_source *ev) {
+ info("shutting down...");
quitting(ev);
trackdb_close();
trackdb_deinit();
quitting(ev);
trackdb_close();
trackdb_deinit();