From: Sebastian Harl Date: Tue, 26 Feb 2008 17:15:28 +0000 (+0100) Subject: rrdtool plugin: Added a flush callback. X-Git-Tag: collectd-4.4.0~87^2~4^2~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=077f8e9a1b486670232ba71ef0e6219a45289241;p=collectd.git rrdtool plugin: Added a flush callback. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- 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); }