From 87d378b469c868795694ac870da907664b2ceb42 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Sat, 23 Feb 2019 14:31:16 +0100 Subject: [PATCH] Convert last call to SIMIX_mutex_unref. --- include/xbt/synchro.h | 4 ++++ src/xbt/xbt_os_synchro.cpp | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/xbt/synchro.h b/include/xbt/synchro.h index 6970239566..96d7556e3d 100644 --- a/include/xbt/synchro.h +++ b/include/xbt/synchro.h @@ -27,7 +27,11 @@ SG_BEGIN_DECL() /** @brief Thread mutex data type (opaque object) * @hideinitializer */ +#ifdef __cplusplus +typedef simgrid::kernel::activity::MutexImpl* xbt_mutex_t; +#else typedef struct s_smx_mutex_* xbt_mutex_t; +#endif /** @brief Creates a new mutex variable */ XBT_PUBLIC xbt_mutex_t xbt_mutex_init(void); diff --git a/src/xbt/xbt_os_synchro.cpp b/src/xbt/xbt_os_synchro.cpp index b176469643..1992ab40f2 100644 --- a/src/xbt/xbt_os_synchro.cpp +++ b/src/xbt/xbt_os_synchro.cpp @@ -9,6 +9,7 @@ #include "simgrid/Exception.hpp" #include "simgrid/simix.h" /* used implementation */ #include "src/kernel/activity/ConditionVariableImpl.hpp" +#include "src/kernel/activity/MutexImpl.hpp" #include "xbt/synchro.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync, xbt, "Synchronization mechanism"); @@ -36,7 +37,8 @@ void xbt_mutex_release(xbt_mutex_t mutex) void xbt_mutex_destroy(xbt_mutex_t mutex) { - SIMIX_mutex_unref((smx_mutex_t)mutex); + if (mutex != nullptr) + mutex->unref(); } /***** condition related functions *****/ -- 2.20.1