Lines Matching refs:ctx
48 isc_result_t isc__app_ctxstart(isc_appctx_t *ctx);
51 isc_result_t isc__app_ctxrun(isc_appctx_t *ctx);
53 isc_result_t isc__app_ctxshutdown(isc_appctx_t *ctx);
56 isc_result_t isc__app_ctxsuspend(isc_appctx_t *ctx);
57 void isc__app_ctxfinish(isc_appctx_t *ctx);
63 void isc__appctx_settaskmgr(isc_appctx_t *ctx, isc_taskmgr_t *taskmgr);
64 void isc__appctx_setsocketmgr(isc_appctx_t *ctx, isc_socketmgr_t *socketmgr);
65 void isc__appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr);
66 isc_result_t isc__app_ctxonrun(isc_appctx_t *ctx, isc_mem_t *mctx,
149 isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
152 REQUIRE(VALID_APPCTX(ctx));
160 result = isc_mutex_init(&ctx->lock);
164 ctx->shutdown_requested = ISC_FALSE;
165 ctx->running = ISC_FALSE;
166 ctx->want_shutdown = ISC_FALSE;
167 ctx->want_reload = ISC_FALSE;
168 ctx->blocked = ISC_FALSE;
171 ctx->hEvents[RELOAD_EVENT] = CreateEvent(NULL, FALSE, FALSE, NULL);
174 ctx->hEvents[SHUTDOWN_EVENT] = CreateEvent(NULL, FALSE, FALSE, NULL);
176 ISC_LIST_INIT(ctx->on_run);
203 isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
208 LOCK(&ctx->lock);
210 if (ctx->running) {
228 ISC_LIST_APPEND(ctx->on_run, event, ev_link);
233 UNLOCK(&ctx->lock);
240 isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
246 REQUIRE(VALID_APPCTX(ctx));
250 LOCK(&ctx->lock);
252 if (!ctx->running) {
253 ctx->running = ISC_TRUE;
258 for (event = ISC_LIST_HEAD(ctx->on_run);
262 ISC_LIST_UNLINK(ctx->on_run, event, ev_link);
270 UNLOCK(&ctx->lock);
277 while (!ctx->want_shutdown) {
278 dwWaitResult = WaitForMultipleObjects(NUM_EVENTS, ctx->hEvents,
290 ctx->want_reload = ISC_TRUE;
294 ctx->want_shutdown = ISC_TRUE;
299 if (ctx->want_reload) {
300 ctx->want_reload = ISC_FALSE;
304 if (ctx->want_shutdown && ctx->blocked)
318 isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
321 REQUIRE(VALID_APPCTX(ctx));
323 LOCK(&ctx->lock);
325 REQUIRE(ctx->running);
327 if (ctx->shutdown_requested)
330 ctx->shutdown_requested = ISC_TRUE;
332 UNLOCK(&ctx->lock);
335 SetEvent(ctx->hEvents[SHUTDOWN_EVENT]);
347 isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
350 REQUIRE(VALID_APPCTX(ctx));
352 LOCK(&ctx->lock);
354 REQUIRE(ctx->running);
359 if (ctx->shutdown_requested)
362 UNLOCK(&ctx->lock);
365 SetEvent(ctx->hEvents[RELOAD_EVENT]);
377 isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
379 REQUIRE(VALID_APPCTX(ctx));
381 DESTROYLOCK(&ctx->lock);
409 isc__appctx_t *ctx;
414 ctx = isc_mem_get(mctx, sizeof(*ctx));
415 if (ctx == NULL)
418 ctx->common.impmagic = APPCTX_MAGIC;
419 ctx->common.magic = ISCAPI_APPCTX_MAGIC;
420 ctx->common.methods = &appmethods.methods;
422 ctx->mctx = NULL;
423 isc_mem_attach(mctx, &ctx->mctx);
425 ctx->taskmgr = NULL;
426 ctx->socketmgr = NULL;
427 ctx->timermgr = NULL;
429 *ctxp = (isc_appctx_t *)ctx;
436 isc__appctx_t *ctx;
439 ctx = (isc__appctx_t *)*ctxp;
440 REQUIRE(VALID_APPCTX(ctx));
442 isc_mem_putanddetach(&ctx->mctx, ctx, sizeof(*ctx));
449 isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
451 REQUIRE(VALID_APPCTX(ctx));
453 ctx->taskmgr = taskmgr;
458 isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
460 REQUIRE(VALID_APPCTX(ctx));
462 ctx->socketmgr = socketmgr;
467 isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
469 REQUIRE(VALID_APPCTX(ctx));
471 ctx->timermgr = timermgr;