From b4d3ff2d460607ba8e1b351233cb6cbe9f031264 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 29 Dec 2019 14:39:27 -0800 Subject: fixes #1064 Potential deadlock in statistics code fixes #1063 Include sanitizer runs in CI fixes #1068 Wssfile test sometimes fails with wrong error code While here, addressed a number of clang-tidy items, and some light cleanup of code we were already in. --- src/core/stats.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/core/stats.h') diff --git a/src/core/stats.h b/src/core/stats.h index 215e07d8..12dbbbdd 100644 --- a/src/core/stats.h +++ b/src/core/stats.h @@ -54,8 +54,16 @@ struct nni_stat_item { #endif }; -void nni_stat_append(nni_stat_item *, nni_stat_item *); -void nni_stat_remove(nni_stat_item *); +// nni_stat_add adds a statistic, but the operation is unlocked, and the +// add is to an unregistered stats tree. +void nni_stat_add(nni_stat_item *, nni_stat_item *); + +// nni_stat_register registers a statistic tree into the global tree. +// The tree is rooted at the root. This is a locked operation. +void nni_stat_register(nni_stat_item *); + +// nni_stat_unregister removes the entire tree. This is a locked operation. +void nni_stat_unregister(nni_stat_item *); void nni_stat_set_value(nni_stat_item *, uint64_t); void nni_stat_set_string(nni_stat_item *, const char *); -- cgit v1.2.3-70-g09d2