static isc_mutex_t createlock;
static isc_once_t once = ISC_ONCE_INIT;
static isc_appctxcreatefunc_t appctx_createfunc = NULL;
+static isc_mutex_t runninglock;
static bool is_running = false;
#define ISCAPI_APPMETHODS_VALID(m) ISC_MAGIC_VALID(m, ISCAPI_APPMETHODS_MAGIC)
static void
initialize(void) {
RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS);
+ RUNTIME_CHECK(isc_mutex_init(&runninglock) == ISC_R_SUCCESS);
}
isc_result_t
if (isc_bind9) {
isc_result_t result;
+ RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS);
+
+ LOCK(&runninglock);
is_running = true;
+ UNLOCK(&runninglock);
result = isc__app_run();
+ LOCK(&runninglock);
is_running = false;
+ UNLOCK(&runninglock);
return (result);
}
bool
isc_app_isrunning() {
- return (is_running);
+ bool running;
+
+ RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS);
+
+ LOCK(&runninglock);
+ running = is_running;
+ UNLOCK(&runninglock);
+
+ return (running);
}
isc_result_t
isc_mem_t *mctx;
isc_mutex_t lock;
isc_eventlist_t on_run;
- bool shutdown_requested;
- bool running;
+ bool shutdown_requested;
+ bool running;
/*!
* We assume that 'want_shutdown' can be read and written atomically.
*/
- bool want_shutdown;
+ bool want_shutdown;
/*
* We assume that 'want_reload' can be read and written atomically.
*/
- bool want_reload;
+ bool want_reload;
- bool blocked;
+ bool blocked;
isc_taskmgr_t *taskmgr;
isc_socketmgr_t *socketmgr;