Of course, the code it calls into isn't thread-safe itself yet.
Signed-off-by: Ben Pfaff <[email protected]>
---
lib/vlog.h | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/vlog.h b/lib/vlog.h
index b2e1d49..da0aa0c 100644
--- a/lib/vlog.h
+++ b/lib/vlog.h
@@ -233,13 +233,13 @@ void vlog_usage(void);
vlog_rate_limit(THIS_MODULE, level__, RL, __VA_ARGS__); \
} \
} while (0)
-#define VLOG_ONCE(LEVEL, ...) \
- do { \
- static bool already_logged; \
- if (!already_logged) { \
- already_logged = true; \
- vlog(THIS_MODULE, LEVEL, __VA_ARGS__); \
- } \
+#define VLOG_ONCE(LEVEL, ...) \
+ do { \
+ static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; \
+ if (ovsthread_once_start(&once)) { \
+ vlog(THIS_MODULE, LEVEL, __VA_ARGS__); \
+ ovsthread_once_done(&once); \
+ } \
} while (0)
#define VLOG_DEFINE_MODULE__(MODULE) \
--
1.7.2.5
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev