From: Martin Mares Date: Fri, 25 Feb 2011 23:32:21 +0000 (+0100) Subject: Main: Tests now include main_cleanup() X-Git-Tag: v5.0~129^2~12 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=60418b4db60801d7c3fc995bf71f53ff5d898484;p=libucw.git Main: Tests now include main_cleanup() --- diff --git a/ucw/main-test.c b/ucw/main-test.c index 1df357bb..41b6b5c6 100644 --- a/ucw/main-test.c +++ b/ucw/main-test.c @@ -21,6 +21,7 @@ static struct main_block_io fin, fout; static struct main_hook hook; static struct main_timer tm; static struct main_signal sg; +static int sig_counter; static byte rb[16]; @@ -52,6 +53,8 @@ static void dwrite(struct main_block_io *bio UNUSED) static int dhook(struct main_hook *ho UNUSED) { msg(L_INFO, "Hook called"); + if (sig_counter >= 3) + return HOOK_SHUTDOWN; return 0; } @@ -78,7 +81,8 @@ static void dexit(struct main_process *pr) static void dsignal(struct main_signal *sg UNUSED) { - msg(L_INFO, "SIGINT received (use Ctrl-\\ to really quit)"); + msg(L_INFO, "SIGINT received (send 3 times to really quit, or use Ctrl-\\)"); + sig_counter++; } int @@ -115,6 +119,13 @@ main(void) main_loop(); msg(L_INFO, "Finished."); + + block_io_del(&fin); + block_io_del(&fout); + hook_del(&hook); + signal_del(&sg); + main_cleanup(); + return 0; } #endif