From 077f8e9a1b486670232ba71ef0e6219a45289241 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 26 Feb 2008 18:15:28 +0100 Subject: [PATCH] rrdtool plugin: Added a flush callback. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- src/rrdtool.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rrdtool.c b/src/rrdtool.c index 3bb5a9e7..4e34d6ad 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -947,6 +947,17 @@ static int rrd_write (const data_set_t *ds, const value_list_t *vl) return (status); } /* int rrd_write */ +static int rrd_flush (const int timeout) +{ + if (cache == NULL) + return (0); + + pthread_mutex_lock (&cache_lock); + rrd_cache_flush (timeout); + pthread_mutex_unlock (&cache_lock); + return (0); +} /* int rrd_flush */ + static int rrd_config (const char *key, const char *value) { if (strcasecmp ("CacheTimeout", key) == 0) @@ -1152,5 +1163,6 @@ void module_register (void) config_keys, config_keys_num); plugin_register_init ("rrdtool", rrd_init); plugin_register_write ("rrdtool", rrd_write); + plugin_register_flush ("rrdtool", rrd_flush); plugin_register_shutdown ("rrdtool", rrd_shutdown); } -- 2.30.2