X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/340307c06ecc6e3e02f73820da97f0c6479c62c5..b51da37243dc16575499f4cb7729fe8bdd7fa514:/src/simix/smx_synchro_private.h?ds=sidebyside diff --git a/src/simix/smx_synchro_private.h b/src/simix/smx_synchro_private.h index 73f87c1867..f312483329 100644 --- a/src/simix/smx_synchro_private.h +++ b/src/simix/smx_synchro_private.h @@ -9,6 +9,9 @@ #include +#include +#include + #include "xbt/base.h" #include "xbt/swag.h" #include "xbt/xbt_os_thread.h" @@ -48,17 +51,24 @@ public: if (count == 0) delete mutex; } + + simgrid::s4u::Mutex& mutex() { return mutex_; } + private: std::atomic_int_fast32_t refcount_ { 1 }; + simgrid::s4u::Mutex mutex_; }; } } typedef struct s_smx_cond { - smx_mutex_t mutex; - xbt_swag_t sleeping; /* list of sleeping process */ - std::atomic_int_fast32_t refcount_; + s_smx_cond() : cond_(this) {} + + std::atomic_int_fast32_t refcount_ { 1 }; + smx_mutex_t mutex = nullptr; + xbt_swag_t sleeping = nullptr; /* list of sleeping process */ + simgrid::s4u::ConditionVariable cond_; } s_smx_cond_t; typedef struct s_smx_sem { @@ -66,8 +76,6 @@ typedef struct s_smx_sem { xbt_swag_t sleeping; /* list of sleeping process */ } s_smx_sem_t; - - XBT_PRIVATE void SIMIX_post_synchro(smx_synchro_t synchro); XBT_PRIVATE void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall); XBT_PRIVATE void SIMIX_synchro_destroy(smx_synchro_t synchro);