summaryrefslogtreecommitdiffstats
path: root/libnetdata/dictionary/dictionary.h
diff options
context:
space:
mode:
Diffstat (limited to 'libnetdata/dictionary/dictionary.h')
-rw-r--r--libnetdata/dictionary/dictionary.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/libnetdata/dictionary/dictionary.h b/libnetdata/dictionary/dictionary.h
index 58220def..c13d784c 100644
--- a/libnetdata/dictionary/dictionary.h
+++ b/libnetdata/dictionary/dictionary.h
@@ -112,7 +112,7 @@ struct dictionary_stats {
#define dictionary_create_advanced(options, stats, fixed_size) dictionary_create_advanced_with_trace(options, stats, fixed_size, __FUNCTION__, __LINE__, __FILE__)
DICTIONARY *dictionary_create_advanced_with_trace(DICT_OPTIONS options, struct dictionary_stats *stats, size_t fixed_size, const char *function, size_t line, const char *file);
#else
-#define dictionary_create(options) dictionary_create_advanced(options, NULL, 0);
+#define dictionary_create(options) dictionary_create_advanced(options, NULL, 0)
DICTIONARY *dictionary_create_advanced(DICT_OPTIONS options, struct dictionary_stats *stats, size_t fixed_size);
#endif
@@ -156,6 +156,8 @@ void dictionary_flush(DICTIONARY *dict);
void dictionary_version_increment(DICTIONARY *dict);
+void dictionary_garbage_collect(DICTIONARY *dict);
+
// ----------------------------------------------------------------------------
// Set an item in the dictionary
//
@@ -261,19 +263,20 @@ void dictionary_write_lock(DICTIONARY *dict);
void dictionary_write_unlock(DICTIONARY *dict);
typedef DICTFE_CONST struct dictionary_foreach {
- DICTIONARY *dict; // the dictionary upon we work
+ DICTIONARY *dict; // the dictionary upon we work
DICTIONARY_ITEM *item; // the item we work on, to remember the position we are at
// this can be used with dictionary_acquired_item_dup() to
// acquire the currently working item.
- DICTFE_CONST char *name; // the dictionary name of the last item used
+ const char *name; // the dictionary name of the last item used
void *value; // the dictionary value of the last item used
// same as the return value of dictfe_start() and dictfe_next()
size_t counter; // counts the number of iterations made, starting from zero
char rw; // the lock mode 'r' or 'w'
+ bool locked; // true when the dictionary is locked
} DICTFE;
#define dfe_start_read(dict, value) dfe_start_rw(dict, value, DICTIONARY_LOCK_READ)
@@ -294,9 +297,12 @@ typedef DICTFE_CONST struct dictionary_foreach {
dictionary_foreach_done(&value ## _dfe); \
} while(0)
+#define dfe_unlock(value) dictionary_foreach_unlock(&value ## _dfe);
+
void *dictionary_foreach_start_rw(DICTFE *dfe, DICTIONARY *dict, char rw);
void *dictionary_foreach_next(DICTFE *dfe);
void dictionary_foreach_done(DICTFE *dfe);
+void dictionary_foreach_unlock(DICTFE *dfe);
// ----------------------------------------------------------------------------
// Get statistics about the dictionary