Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
replace SIMIX_execution_start by modern simcall
[simgrid.git] / src / msg / msg_task.cpp
index cee11fc..d7fbc11 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -6,6 +6,7 @@
 #include "msg_private.hpp"
 #include "src/simix/smx_private.hpp"
 #include <algorithm>
+#include <cmath>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_task, msg, "Logging specific to MSG (task)");
 
@@ -186,9 +187,9 @@ msg_error_t MSG_task_cancel(msg_task_t task)
 
   simdata_task_t simdata = task->simdata;
   if (simdata->compute) {
-    simcall_execution_cancel(simdata->compute);
+    simgrid::simix::simcall([simdata] { simdata->compute->cancel(); });
   } else if (simdata->comm) {
-    simcall_comm_cancel(simdata->comm);
+    simgrid::simix::simcall([simdata] { simdata->comm->cancel(); });
   }
   simdata->setNotUsed();
   return MSG_OK;
@@ -275,8 +276,9 @@ double MSG_task_get_bytes_amount(msg_task_t task)
 void MSG_task_set_priority(msg_task_t task, double priority)
 {
   task->simdata->priority = 1 / priority;
+  xbt_assert(std::isfinite(task->simdata->priority), "priority is not finite!");
   if (task->simdata->compute)
-    simcall_execution_set_priority(task->simdata->compute, task->simdata->priority);
+    simgrid::simix::simcall([task] { task->simdata->compute->set_priority(task->simdata->priority); });
 }
 
 /** @brief Changes the maximum CPU utilization of a computation task (in flops/s).
@@ -290,5 +292,5 @@ void MSG_task_set_bound(msg_task_t task, double bound)
 
   task->simdata->bound = bound;
   if (task->simdata->compute)
-    simcall_execution_set_bound(task->simdata->compute, task->simdata->bound);
+    simgrid::simix::simcall([task, bound] { task->simdata->compute->set_bound(bound); });
 }