Without this change, catv.threshold can be initialized by another
thread, between the test for priority being great enough, and
that for catv.threshold being initialized, leading to a false
positive answer.
Hypothesis
==========
Initially, catv.threshold == xbt_log_priority_unititialized == -1
After initialization, priority < catv.threshold
Two threads running _XBT_LOG_ISENABLEDV() for the same
category, and the same priority.
Thread A Thread B
======== ========
priority >= cat.threshold
is TRUE
priority >= catv.threshold
is TRUE
catv.threshold != x.l.p._uninitialized
is FALSE
call xbt_log_cat_init(...)
returns FALSE
catv.threshold != x.l.p._uninitialized
is TRUE
=> _XBT_LOG_ISENABLEDV(...) => _XBT_LOG_ISENABLEDV(...)
is FALSE is TRUE
*/
#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