Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix a race condition in _XBT_LOG_ISENABLEDV().
[simgrid.git] / include / xbt / log.h
index 4338b65..ad7e612 100644 (file)
@@ -365,9 +365,9 @@ extern xbt_log_layout_t xbt_log_default_layout;
  */
 #define _XBT_LOG_ISENABLEDV(catv, priority)                  \
        (priority >= XBT_LOG_STATIC_THRESHOLD                 \
-        && priority >= catv.threshold                         \
         && (catv.threshold != xbt_log_priority_uninitialized \
-            || _xbt_log_cat_init(&catv, priority)) )
+            || _xbt_log_cat_init(&catv, priority))           \
+        && priority >= catv.threshold)
 
 /*
  * Internal Macros
@@ -393,7 +393,6 @@ extern xbt_log_layout_t xbt_log_default_layout;
   fprintf(stderr,"%s:%d:\n" f, __FILE__, __LINE__, __VA_ARGS__)
 # define XBT_LOG(...) XBT_CLOG(0, __VA_ARGS__)
 #else
-# include <string.h>            /* memset */
 # define XBT_CLOG_(catv, prio, ...)                                     \
   do {                                                                  \
     if (_XBT_LOG_ISENABLEDV(catv, prio)) {                              \