{
#define _xbt_log_cat_init(a, b) (0)
- xbt_os_rmutex_acquire(log_cat_init_mutex);
+ if (log_cat_init_mutex != NULL) {
+ xbt_os_rmutex_acquire(log_cat_init_mutex);
+ }
+
if (category->threshold != xbt_log_priority_uninitialized) {
- xbt_os_rmutex_release(log_cat_init_mutex);
+ if (log_cat_init_mutex != NULL) {
+ xbt_os_rmutex_release(log_cat_init_mutex);
+ }
return priority >= category->threshold;
}
/* Apply the control */
if (!xbt_log_settings) {
- xbt_os_rmutex_release(log_cat_init_mutex);
+ if (log_cat_init_mutex != NULL) {
+ xbt_os_rmutex_release(log_cat_init_mutex);
+ }
return priority >= category->threshold;
}
category->name, xbt_log_priority_names[category->threshold],
category->threshold);
- xbt_os_rmutex_release(log_cat_init_mutex);
+ if (log_cat_init_mutex != NULL) {
+ xbt_os_rmutex_release(log_cat_init_mutex);
+ }
return priority >= category->threshold;
#undef _xbt_log_cat_init
void xbt_os_rmutex_acquire(xbt_os_rmutex_t rmutex)
{
xbt_os_thread_t self = xbt_os_thread_self();
- xbt_assert(self != NULL, "Cannot get my own thread object (is the thread module initialized?)");
+
+ if (self == NULL) {
+ /* the thread module is not initialized yet */
+ rmutex->owner = NULL;
+ return;
+ }
if (self != rmutex->owner) {
xbt_os_mutex_acquire(rmutex->mutex);
void xbt_os_rmutex_release(xbt_os_rmutex_t rmutex)
{
+ if (rmutex->owner == NULL) {
+ /* the thread module was not initialized */
+ return;
+ }
+
xbt_assert(rmutex->owner == xbt_os_thread_self());
if (--rmutex->count == 0) {