From 0e5a1a102ea98f67254e1e314c793de771dc1ed8 Mon Sep 17 00:00:00 2001 From: kanoi Date: Tue, 4 Nov 2014 21:59:41 +1100 Subject: [PATCH] ckdb - remove summariser sleep delays during shutdown --- src/ckdb.c | 32 +++++++++++++++++++++++++------- src/ckdb.h | 2 +- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/ckdb.c b/src/ckdb.c index 8c347046..794b9270 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -1765,6 +1765,8 @@ static void summarise_userstats() static void *summariser(__maybe_unused void *arg) { + int i; + pthread_detach(pthread_self()); rename_proc("db_summariser"); @@ -1773,19 +1775,35 @@ static void *summariser(__maybe_unused void *arg) cksleep_ms(42); while (!everyone_die) { - sleep(5); - if (!everyone_die) { + for (i = 0; i < 5; i++) { + if (!everyone_die) + sleep(1); + } + if (everyone_die) + break; + else { if (startup_complete) check_blocks(); - summarise_blocks(); + if (!everyone_die) + summarise_blocks(); } - sleep(4); - if (!everyone_die) + for (i = 0; i < 4; i++) { + if (!everyone_die) + sleep(1); + } + if (everyone_die) + break; + else summarise_poolstats(); - sleep(4); - if (!everyone_die) + for (i = 0; i < 4; i++) { + if (!everyone_die) + sleep(1); + } + if (everyone_die) + break; + else summarise_userstats(); } diff --git a/src/ckdb.h b/src/ckdb.h index d2ec5c9f..a4fdb239 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -52,7 +52,7 @@ #define DB_VLOCK "1" #define DB_VERSION "0.9.2" -#define CKDB_VERSION DB_VERSION"-0.592" +#define CKDB_VERSION DB_VERSION"-0.593" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__