shutdown_test.c revision 271d5bfc5ca8d746b535d1522f2aa9389ece2a7e
1ccbfca64ae86ace521053773001cb995352f96fBob Halley/*
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * Copyright (C) 1998, 1999 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
1ccbfca64ae86ace521053773001cb995352f96fBob Halley * Permission to use, copy, modify, and distribute this software for any
1ccbfca64ae86ace521053773001cb995352f96fBob Halley * purpose with or without fee is hereby granted, provided that the above
1ccbfca64ae86ace521053773001cb995352f96fBob Halley * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
15a44745412679c30a6d022733925af70a38b715David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
15a44745412679c30a6d022733925af70a38b715David Lawrence * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
15a44745412679c30a6d022733925af70a38b715David Lawrence * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15a44745412679c30a6d022733925af70a38b715David Lawrence * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15a44745412679c30a6d022733925af70a38b715David Lawrence * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
15a44745412679c30a6d022733925af70a38b715David Lawrence * SOFTWARE.
1ccbfca64ae86ace521053773001cb995352f96fBob Halley */
1ccbfca64ae86ace521053773001cb995352f96fBob Halley
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington#include <config.h>
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#include <stdio.h>
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#include <stdlib.h>
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#include <unistd.h>
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
1ccbfca64ae86ace521053773001cb995352f96fBob Halley#include <isc/assertions.h>
1ccbfca64ae86ace521053773001cb995352f96fBob Halley#include <isc/error.h>
341323e0e7ef69f7c425cd3462afe06d0930c528Michael Graff#include <isc/mem.h>
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#include <isc/task.h>
364a82f7c25b62967678027043425201a5e5171aBob Halley#include <isc/thread.h>
1ccbfca64ae86ace521053773001cb995352f96fBob Halley#include <isc/result.h>
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#include <isc/timer.h>
c03ce72a3b1bd639d5bc430ed37f791051125c56Andreas Gustafsson#include <isc/mutex.h>
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley#include <isc/condition.h>
341323e0e7ef69f7c425cd3462afe06d0930c528Michael Graff#include <isc/event.h>
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#include <isc/eventclass.h>
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#include <isc/app.h>
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleytypedef struct {
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_mem_t * mctx;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_task_t * task;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_timer_t * timer;
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence unsigned int ticks;
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff char name[16];
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews isc_boolean_t exiting;
0e3ad060581e366d3e682caf2dd5d9ea2e0f4893Bob Halley isc_task_t * peer;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley} t_info;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#define MAX_TASKS 3
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#define T2_SHUTDOWNOK (ISC_EVENTCLASS(1024) + 0)
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#define T2_SHUTDOWNDONE (ISC_EVENTCLASS(1024) + 1)
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley#define FOO_EVENT (ISC_EVENTCLASS(1024) + 2)
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleystatic t_info tasks[MAX_TASKS];
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleystatic unsigned int task_count;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleystatic isc_taskmgr_t * task_manager;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleystatic isc_timermgr_t * timer_manager;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleystatic void
1ccbfca64ae86ace521053773001cb995352f96fBob Halleyt1_shutdown(isc_task_t *task, isc_event_t *event) {
1ccbfca64ae86ace521053773001cb995352f96fBob Halley t_info *info = event->arg;
0e3ad060581e366d3e682caf2dd5d9ea2e0f4893Bob Halley
1ccbfca64ae86ace521053773001cb995352f96fBob Halley printf("task %s (%p) t1_shutdown\n", info->name, task);
68e4926b2262571e004b4be00b905ec776c01d9cMichael Graff isc_task_detach(&info->task);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_event_free(&event);
0e3ad060581e366d3e682caf2dd5d9ea2e0f4893Bob Halley}
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleystatic void
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleyt2_shutdown(isc_task_t *task, isc_event_t *event) {
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley t_info *info = event->arg;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley printf("task %s (%p) t2_shutdown\n", info->name, task);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley info->exiting = ISC_TRUE;
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff isc_event_free(&event);
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence}
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews
1ccbfca64ae86ace521053773001cb995352f96fBob Halleystatic void
1ccbfca64ae86ace521053773001cb995352f96fBob Halleyshutdown_action(isc_task_t *task, isc_event_t *event) {
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley t_info *info = event->arg;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_event_t *nevent;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley INSIST(event->type == ISC_TASKEVENT_SHUTDOWN);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley printf("task %s (%p) shutdown\n", info->name, task);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley if (strcmp(info->name, "0") == 0) {
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_timer_detach(&info->timer);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley nevent = isc_event_allocate(info->mctx, info, T2_SHUTDOWNOK,
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley t2_shutdown, &tasks[1],
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley sizeof *event);
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews RUNTIME_CHECK(nevent != NULL);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley info->exiting = ISC_TRUE;
1ccbfca64ae86ace521053773001cb995352f96fBob Halley isc_task_sendanddetach(&info->peer, &nevent);
c03ce72a3b1bd639d5bc430ed37f791051125c56Andreas Gustafsson }
c03ce72a3b1bd639d5bc430ed37f791051125c56Andreas Gustafsson isc_event_free(&event);
c03ce72a3b1bd639d5bc430ed37f791051125c56Andreas Gustafsson}
c03ce72a3b1bd639d5bc430ed37f791051125c56Andreas Gustafsson
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graffstatic void
1ccbfca64ae86ace521053773001cb995352f96fBob Halleyfoo_event(isc_task_t *task, isc_event_t *event) {
1ccbfca64ae86ace521053773001cb995352f96fBob Halley printf("task(%p) foo\n", task);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley isc_event_free(&event);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley}
1ccbfca64ae86ace521053773001cb995352f96fBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleystatic void
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleytick(isc_task_t *task, isc_event_t *event)
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley{
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley t_info *info = event->arg;
1ccbfca64ae86ace521053773001cb995352f96fBob Halley isc_event_t *nevent;
2d63e8f8d2a8ef70e404182caf5b0d95dbcf2027Andreas Gustafsson
1ccbfca64ae86ace521053773001cb995352f96fBob Halley INSIST(event->type == ISC_TIMEREVENT_TICK);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley printf("task %s (%p) tick\n", info->name, task);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
1ccbfca64ae86ace521053773001cb995352f96fBob Halley info->ticks++;
1ccbfca64ae86ace521053773001cb995352f96fBob Halley if (strcmp(info->name, "1") == 0) {
1ccbfca64ae86ace521053773001cb995352f96fBob Halley if (info->ticks == 10) {
1ccbfca64ae86ace521053773001cb995352f96fBob Halley RUNTIME_CHECK(isc_app_shutdown() == ISC_R_SUCCESS);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley } else if (info->ticks >= 15 && info->exiting) {
1ccbfca64ae86ace521053773001cb995352f96fBob Halley isc_timer_detach(&info->timer);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_task_detach(&info->task);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley nevent = isc_event_allocate(info->mctx, info,
1ccbfca64ae86ace521053773001cb995352f96fBob Halley T2_SHUTDOWNDONE,
1ccbfca64ae86ace521053773001cb995352f96fBob Halley t1_shutdown, &tasks[0],
1ccbfca64ae86ace521053773001cb995352f96fBob Halley sizeof *event);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley RUNTIME_CHECK(nevent != NULL);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley isc_task_send(info->peer, &nevent);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_task_detach(&info->peer);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley }
1ccbfca64ae86ace521053773001cb995352f96fBob Halley } else if (strcmp(info->name, "foo") == 0) {
1ccbfca64ae86ace521053773001cb995352f96fBob Halley isc_timer_detach(&info->timer);
d549c3734869b48e740c64e80890bcb6f3ce672cJames Brister nevent = isc_event_allocate(info->mctx, info,
d549c3734869b48e740c64e80890bcb6f3ce672cJames Brister FOO_EVENT,
d549c3734869b48e740c64e80890bcb6f3ce672cJames Brister foo_event, task,
d549c3734869b48e740c64e80890bcb6f3ce672cJames Brister sizeof *event);
d549c3734869b48e740c64e80890bcb6f3ce672cJames Brister RUNTIME_CHECK(nevent != NULL);
d549c3734869b48e740c64e80890bcb6f3ce672cJames Brister isc_task_sendanddetach(&task, &nevent);
d549c3734869b48e740c64e80890bcb6f3ce672cJames Brister }
d549c3734869b48e740c64e80890bcb6f3ce672cJames Brister
d549c3734869b48e740c64e80890bcb6f3ce672cJames Brister isc_event_free(&event);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley}
1ccbfca64ae86ace521053773001cb995352f96fBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleystatic t_info *
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halleynew_task(isc_mem_t *mctx, char *name) {
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley t_info *ti;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_time_t expires;
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence isc_interval_t interval;
1ccbfca64ae86ace521053773001cb995352f96fBob Halley
1ccbfca64ae86ace521053773001cb995352f96fBob Halley RUNTIME_CHECK(task_count < MAX_TASKS);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley ti = &tasks[task_count];
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley ti->mctx = mctx;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley ti->task = NULL;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley ti->timer = NULL;
1ccbfca64ae86ace521053773001cb995352f96fBob Halley ti->ticks = 0;
1ccbfca64ae86ace521053773001cb995352f96fBob Halley if (name != NULL) {
1ccbfca64ae86ace521053773001cb995352f96fBob Halley INSIST(strlen(name) < sizeof ti->name);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley strcpy(ti->name, name);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley } else
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley sprintf(ti->name, "%d", task_count);
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley RUNTIME_CHECK(isc_task_create(task_manager, mctx, 0, &ti->task) ==
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley ISC_R_SUCCESS);
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence RUNTIME_CHECK(isc_task_onshutdown(ti->task, shutdown_action, ti) ==
1ccbfca64ae86ace521053773001cb995352f96fBob Halley ISC_R_SUCCESS);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews isc_time_settoepoch(&expires);
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews isc_interval_set(&interval, 1, 0);
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews RUNTIME_CHECK(isc_timer_create(timer_manager, isc_timertype_ticker,
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews &expires, &interval, ti->task,
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews tick, ti, &ti->timer) ==
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews ISC_R_SUCCESS);
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews task_count++;
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews return (ti);
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews}
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrenceint
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrewsmain(int argc, char *argv[]) {
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews unsigned int workers;
a6733246eafeb43755ce6d7ec3627ac4209cbccbMark Andrews t_info *t1, *t2, *t3;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_task_t *task;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley isc_mem_t *mctx, *mctx2;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley
1ccbfca64ae86ace521053773001cb995352f96fBob Halley RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS);
1ccbfca64ae86ace521053773001cb995352f96fBob Halley
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley if (argc > 1)
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley workers = atoi(argv[1]);
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley else
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley workers = 2;
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley printf("%d workers\n", workers);
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence mctx = NULL;
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley mctx2 = NULL;
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley RUNTIME_CHECK(isc_mem_create(0, 0, &mctx2) == ISC_R_SUCCESS);
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &task_manager) ==
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley ISC_R_SUCCESS);
b3e2e7c4d6b5c5ee90ba5bb775d635834dccec81Bob Halley RUNTIME_CHECK(isc_timermgr_create(mctx, &timer_manager) ==
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington ISC_R_SUCCESS);
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington t1 = new_task(mctx, NULL);
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington t2 = new_task(mctx2, NULL);
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington isc_task_attach(t2->task, &t1->peer);
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington isc_task_attach(t1->task, &t2->peer);
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington /*
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington * Test run-triggered shutdown.
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington */
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington t3 = new_task(mctx2, "foo");
fe12eb4fc27f49c6b3e42b1d7a6b40310e41e6dfBrian Wellington
a99979c686ae04efd55ba8f0aacf32493b4aa7faBob Halley /*
a99979c686ae04efd55ba8f0aacf32493b4aa7faBob Halley * Test implicit shutdown.
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley */
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley task = NULL;
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley RUNTIME_CHECK(isc_task_create(task_manager, mctx, 0, &task) ==
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley ISC_R_SUCCESS);
a99979c686ae04efd55ba8f0aacf32493b4aa7faBob Halley isc_task_detach(&task);
a99979c686ae04efd55ba8f0aacf32493b4aa7faBob Halley
62837b832f6a9999976d607eb0a9125bbbbb138bBob Halley /*
a99979c686ae04efd55ba8f0aacf32493b4aa7faBob Halley * Test anti-zombie code.
a99979c686ae04efd55ba8f0aacf32493b4aa7faBob Halley */
48481c9b6e19501457bcbc2995555412f352b99fBob Halley RUNTIME_CHECK(isc_task_create(task_manager, mctx, 0, &task) ==
48481c9b6e19501457bcbc2995555412f352b99fBob Halley ISC_R_SUCCESS);
48481c9b6e19501457bcbc2995555412f352b99fBob Halley isc_task_detach(&task);
48481c9b6e19501457bcbc2995555412f352b99fBob Halley
48481c9b6e19501457bcbc2995555412f352b99fBob Halley RUNTIME_CHECK(isc_app_run() == ISC_R_SUCCESS);
48481c9b6e19501457bcbc2995555412f352b99fBob Halley
48481c9b6e19501457bcbc2995555412f352b99fBob Halley isc_taskmgr_destroy(&task_manager);
48481c9b6e19501457bcbc2995555412f352b99fBob Halley isc_timermgr_destroy(&timer_manager);
48481c9b6e19501457bcbc2995555412f352b99fBob Halley
48481c9b6e19501457bcbc2995555412f352b99fBob Halley printf("Statistics for mctx:\n");
48481c9b6e19501457bcbc2995555412f352b99fBob Halley isc_mem_stats(mctx, stdout);
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff isc_mem_destroy(&mctx);
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley printf("Statistics for mctx2:\n");
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley isc_mem_stats(mctx2, stdout);
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley isc_mem_destroy(&mctx2);
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley isc_app_finish();
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley return (0);
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley}
7d44d8aacda98eb2b526af34757a6bbcc97cd388Bob Halley