X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fb588fbb8c119a8f04e6d2cb15b663257786ba70..c8880fd8bfe302109bdec0629929499479d714b0:/src/surf/cpu_cas01.cpp diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 5464386e09..b58815c16a 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -85,7 +85,8 @@ CpuCas01Model::CpuCas01Model() : CpuModel("cpu") } if (getUpdateMechanism() == UM_LAZY) { - p_actionHeap = new ActionHeap(); + p_actionHeap = xbt_heap_new(8, NULL); + xbt_heap_set_update_callback(p_actionHeap, surf_action_lmm_update_index_heap); p_modifiedSet = new ActionLmmList(); p_maxminSystem->keep_track = p_modifiedSet; } @@ -97,7 +98,7 @@ CpuCas01Model::~CpuCas01Model() p_maxminSystem = NULL; if (p_actionHeap) - delete p_actionHeap; + xbt_heap_free(p_actionHeap); delete p_modifiedSet; surf_cpu_model_pm = NULL; @@ -314,7 +315,7 @@ CpuActionPtr CpuCas01::sleep(double duration) lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), 0.0); if (getModel()->getUpdateMechanism() == UM_LAZY) { // remove action from the heap - action->heapRemove(); + action->heapRemove(getModel()->getActionHeap()); // this is necessary for a variable with weight 0 since such // variables are ignored in lmm and we need to set its max_duration // correctly at the next call to share_resources @@ -364,6 +365,7 @@ CpuCas01Action::CpuCas01Action(ModelPtr model, double cost, bool failed, double { m_suspended = 0; if (model->getUpdateMechanism() == UM_LAZY) { + m_indexHeap = -1; m_lastUpdate = surf_get_clock(); m_lastValue = 0.0; }