2008-10-26
2008-10-26 20:26:31 by Martin Stjernholm <mast@lysator.liu.se>
-
d47483285785977baf60ad77249f6e0cca7f3502
(21 lines)
(+17/-4)
[
Show
| Annotate
]
Branch: 5.2
Don't start more background jobs when a shutdown has been initiated.
Added is_shutting_down().
Rev: server/base_server/roxen.pike:1.997
6:
// Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.
// ABS and suicide systems contributed freely by Francesco Chemolli
- constant cvs_version="$Id: roxen.pike,v 1.996 2008/10/12 22:14:03 mast Exp $";
+ constant cvs_version="$Id: roxen.pike,v 1.997 2008/10/26 20:26:31 mast Exp $";
//! @appears roxen
//!
537:
call_out(really_low_shutdown, 0.1, exit_code);
}
+ private int shutdown_started;
+
// Perhaps somewhat misnamed, really... This function will close all
// listen ports and then quit. The 'start' script should then start a
// new copy of roxen automatically.
void restart(float|void i, void|int exit_code)
//! Restart roxen, if the start script is running
{
-
+ shutdown_started = 1;
call_out(low_shutdown, i, exit_code || -1);
}
void shutdown(float|void i)
//! Shut down roxen
{
-
+ shutdown_started = 1;
call_out(low_shutdown, i, 0);
}
void exit_when_done()
{
report_notice("Interrupt request received.\n");
-
+ shutdown_started = 1;
low_shutdown(-1);
}
-
+ int is_shutting_down()
+ //! Returns true if Roxen is shutting down.
+ {
+ return shutdown_started;
+ }
-
+
/*
* handle() stuff
*/
727: Inside #if defined(THREADS) and #if undefined(NO_SLOW_REQ_BT)
if (query ("slow_req_bt_count") && slow_be_timeout > 0.0 &&
// Don't trig if we're shutting down.
- !shutdown_recurse) {
+ !shutdown_started) {
Pike.DefaultBackend->before_callback = slow_be_before_cb;
Pike.DefaultBackend->after_callback = slow_be_after_cb;
}
1177: Inside #if defined(THREADS)
#endif
if (mixed err = catch {
- while (bg_queue->size()) {
+ while (bg_queue->size() && !shutdown_started) {
// Not a race here since only one thread is reading the queue.
array task = bg_queue->read();
1777:
local function sp_fcfu;
-
+ // FIXME: find_configuration_for_url can be called from the backend
+ // thread, so enable_all_modules should be queued for a handler thread.
#define INIT(X) do{ \
mapping _=(X); \
string __=_->path; \