X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/627cef048b8d7a523fa6d2ccaec750eccb0468e9..1aaf3e3fc120f9434c692f1c49d03a00b24e55a1:/src/kernel/resource/Action.cpp diff --git a/src/kernel/resource/Action.cpp b/src/kernel/resource/Action.cpp index 99e9ddf888..52a857cf3e 100644 --- a/src/kernel/resource/Action.cpp +++ b/src/kernel/resource/Action.cpp @@ -38,7 +38,7 @@ Action::~Action() get_model()->getMaxminSystem()->variable_free(get_variable()); if (get_model()->getUpdateMechanism() == UM_LAZY) { /* remove from heap */ - heapRemove(get_model()->getActionHeap()); + heapRemove(); if (modified_set_hook_.is_linked()) simgrid::xbt::intrusive_erase(*get_model()->getModifiedSet(), *this); } @@ -102,7 +102,7 @@ void Action::set_bound(double bound) get_model()->getMaxminSystem()->update_variable_bound(variable_, bound); if (get_model()->getUpdateMechanism() == UM_LAZY && get_last_update() != surf_get_clock()) - heapRemove(get_model()->getActionHeap()); + heapRemove(); XBT_OUT(); } @@ -120,7 +120,7 @@ void Action::set_max_duration(double duration) { max_duration_ = duration; if (get_model()->getUpdateMechanism() == UM_LAZY) // remove action from the heap - heapRemove(get_model()->getActionHeap()); + heapRemove(); } void Action::set_priority(double weight) @@ -130,7 +130,7 @@ void Action::set_priority(double weight) get_model()->getMaxminSystem()->update_variable_weight(get_variable(), weight); if (get_model()->getUpdateMechanism() == UM_LAZY) - heapRemove(get_model()->getActionHeap()); + heapRemove(); XBT_OUT(); } @@ -140,7 +140,7 @@ void Action::cancel() if (get_model()->getUpdateMechanism() == UM_LAZY) { if (modified_set_hook_.is_linked()) simgrid::xbt::intrusive_erase(*get_model()->getModifiedSet(), *this); - heapRemove(get_model()->getActionHeap()); + heapRemove(); } } @@ -160,9 +160,8 @@ void Action::suspend() if (suspended_ != SuspendStates::sleeping) { get_model()->getMaxminSystem()->update_variable_weight(get_variable(), 0.0); if (get_model()->getUpdateMechanism() == UM_LAZY) { - heapRemove(get_model()->getActionHeap()); - if (get_model()->getUpdateMechanism() == UM_LAZY && state_set_ == get_model()->getRunningActionSet() && - sharing_priority_ > 0) { + heapRemove(); + if (state_set_ == get_model()->getRunningActionSet() && sharing_priority_ > 0) { // If we have a lazy model, we need to update the remaining value accordingly update_remains_lazy(surf_get_clock()); } @@ -179,7 +178,7 @@ void Action::resume() get_model()->getMaxminSystem()->update_variable_weight(get_variable(), get_priority()); suspended_ = SuspendStates::not_suspended; if (get_model()->getUpdateMechanism() == UM_LAZY) - heapRemove(get_model()->getActionHeap()); + heapRemove(); } XBT_OUT(); } @@ -195,28 +194,28 @@ bool Action::is_suspended() * LATENCY = this is a heap entry to warn us when the latency is payed * MAX_DURATION =this is a heap entry to warn us when the max_duration limit is reached */ -void Action::heapInsert(heap_type& heap, double key, Action::Type hat) +void Action::heapInsert(double key, Action::Type hat) { type_ = hat; - heap_hook_ = heap.emplace(std::make_pair(key, this)); + heap_hook_ = get_model()->getActionHeap().emplace(std::make_pair(key, this)); } -void Action::heapRemove(heap_type& heap) +void Action::heapRemove() { type_ = Action::Type::NOTSET; if (heap_hook_) { - heap.erase(*heap_hook_); + get_model()->getActionHeap().erase(*heap_hook_); clearHeapHandle(); } } -void Action::heapUpdate(heap_type& heap, double key, Action::Type hat) +void Action::heapUpdate(double key, Action::Type hat) { type_ = hat; if (heap_hook_) { - heap.update(*heap_hook_, std::make_pair(key, this)); + get_model()->getActionHeap().update(*heap_hook_, std::make_pair(key, this)); } else { - heap_hook_ = heap.emplace(std::make_pair(key, this)); + heap_hook_ = get_model()->getActionHeap().emplace(std::make_pair(key, this)); } }