summaryrefslogtreecommitdiff
path: root/lib/frr_pthread.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2025-04-09 09:59:06 +0200
committerGitHub <noreply@github.com>2025-04-09 09:59:06 +0200
commit8418e57791eabc9feba637b69bd9ee35bed6860a (patch)
tree48b9c05795135606782f9ec359c3f319f5d534dc /lib/frr_pthread.h
parent1d426d99619b7818f4b63b52f83fadfe902b9854 (diff)
parent27ba9956a15c17b7e8a6ba38aa8bbb4514fa90df (diff)
Merge pull request #17915 from mjstapp/compile_wshadow
Diffstat (limited to 'lib/frr_pthread.h')
-rw-r--r--lib/frr_pthread.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h
index bb751b7071..368ada36ad 100644
--- a/lib/frr_pthread.h
+++ b/lib/frr_pthread.h
@@ -233,11 +233,13 @@ int frr_pthread_non_controlled_startup(pthread_t thread, const char *name,
unused, cleanup(_frr_mtx_unlock))) = _frr_mtx_lock(mutex), \
/* end */
-#define frr_with_mutex(...) \
- for (pthread_mutex_t MACRO_REPEAT(_frr_with_mutex, ##__VA_ARGS__) \
- *_once = NULL; _once == NULL; _once = (void *)1) \
+#define _frr_with_mutex_once(_once, ...) \
+ for (pthread_mutex_t MACRO_REPEAT(_frr_with_mutex, ##__VA_ARGS__)*_once = NULL; \
+ _once == NULL; _once = (void *)1) \
/* end */
+#define frr_with_mutex(...) _frr_with_mutex_once(NAMECTR(_once_), __VA_ARGS__)
+
/* variant 2:
* (more suitable for long blocks, no extra indentation)
*