From 61a1ca4ca4445b7985fb38d5278cf3aabe22d235 Mon Sep 17 00:00:00 2001 From: Unbit Date: Tue, 26 Feb 2013 19:29:29 +0100 Subject: [PATCH] initialize alarm and exception thread ONLY in the master --- core/alarm.c | 2 ++ core/exceptions.c | 4 ++++ core/master.c | 3 +++ uwsgi.h | 3 +++ 4 files changed, 12 insertions(+) diff --git a/core/alarm.c b/core/alarm.c index bd7d11ad..46c53e66 100644 --- a/core/alarm.c +++ b/core/alarm.c @@ -262,7 +262,9 @@ void uwsgi_alarms_init() { usl = usl->next; } #endif +} +void uwsgi_alarm_thread_start() { // start the alarm_threa uwsgi.alarm_thread = uwsgi_thread_new(uwsgi_alarm_thread_loop); if (!uwsgi.alarm_thread) { diff --git a/core/exceptions.c b/core/exceptions.c index 9274c71f..b9efe668 100644 --- a/core/exceptions.c +++ b/core/exceptions.c @@ -458,6 +458,7 @@ static void uwsgi_exception_handler_thread_loop(struct uwsgi_thread *ut) { } } } + uwsgi_log("STATUS = %d %d %d %d\n", uwsgi.status.gracefully_reloading, uwsgi.status.brutally_reloading, 0, 0); } } @@ -483,6 +484,9 @@ void uwsgi_exception_setup_handlers() { usl->custom_ptr = uehi; usl = usl->next; } +} + +void uwsgi_exceptions_handler_thread_start() { // start the exception_handler_thread uwsgi.exception_handler_thread = uwsgi_thread_new(uwsgi_exception_handler_thread_loop); diff --git a/core/master.c b/core/master.c index dd4c2e63..bac54fbb 100644 --- a/core/master.c +++ b/core/master.c @@ -371,6 +371,9 @@ int master_loop(char **argv, char **environ) { } + uwsgi_alarm_thread_start(); + uwsgi_exceptions_handler_thread_start(); + #ifdef UWSGI_SSL uwsgi_start_legions(); #endif diff --git a/uwsgi.h b/uwsgi.h index d855e8c4..d1fb28d4 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -3857,6 +3857,9 @@ struct uwsgi_exception_handler *uwsgi_register_exception_handler(char *, int (*) void uwsgi_async_queue_is_full(time_t); char *uwsgi_get_header(struct wsgi_request *, char *, uint16_t, uint16_t *); +void uwsgi_alarm_thread_start(void); +void uwsgi_exceptions_handler_thread_start(void); + #define uwsgi_response_add_connection_close(x) uwsgi_response_add_header(x, "Connection", 10, "close", 5) #define uwsgi_response_add_content_type(x, y, z) uwsgi_response_add_header(x, "Content-Type", 12, y, z)