From: Martin Quinson Date: Sun, 13 Aug 2017 21:31:38 +0000 (+0200) Subject: small cleanups in the simix timers X-Git-Tag: v3_17~205 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/17a5f55527a7fd22835025e89f1e8f75aed15849 small cleanups in the simix timers Much more would be due :( --- diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 89f0c5332b..2f8eac9704 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -55,11 +55,12 @@ static xbt_heap_t simix_timers = nullptr; /** @brief Timer datatype */ typedef class s_smx_timer { -public: double date = 0.0; s_smx_timer() = default; - simgrid::xbt::Task callback; +public: + simgrid::xbt::Task callback; + double getDate() { return date; } s_smx_timer(double date, simgrid::xbt::Task callback) : date(date), callback(std::move(callback)) {} } s_smx_timer_t; @@ -574,12 +575,12 @@ smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task callback) /** @brief cancels a timer that was added earlier */ void SIMIX_timer_remove(smx_timer_t timer) { - xbt_heap_rm_elm(simix_timers, timer, timer->date); + xbt_heap_rm_elm(simix_timers, timer, timer->getDate()); } /** @brief Returns the date at which the timer will trigger (or 0 if nullptr timer) */ double SIMIX_timer_get_date(smx_timer_t timer) { - return timer?timer->date:0; + return timer ? timer->getDate() : 0; } /**