Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to get the refcounting right on waitany simcalls
[simgrid.git] / src / msg / msg_gos.cpp
index f3880e3..98d5871 100644 (file)
@@ -71,7 +71,7 @@ msg_error_t MSG_parallel_task_execute_with_timeout(msg_task_t task, double timeo
           boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(simcall_execution_parallel_start(
               task->name, simdata->host_nb, simdata->host_list, simdata->flops_parallel_amount,
               simdata->bytes_parallel_amount, 1.0, -1.0, timeout));
-      XBT_DEBUG("Parallel execution action created: %p", simdata->compute);
+      XBT_DEBUG("Parallel execution action created: %p", simdata->compute.get());
     } else {
       simdata->compute = boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(
           simcall_execution_start(task->name, simdata->flops_amount, simdata->priority, simdata->bound));
@@ -634,11 +634,14 @@ int MSG_comm_waitany(xbt_dynar_t comms)
   int finished_index = -1;
 
   /* create the equivalent dynar with SIMIX objects */
-  xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_activity_t), nullptr);
+  xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_activity_t), [](void*ptr){
+    intrusive_ptr_release((simgrid::kernel::activity::ActivityImpl*)ptr);
+  });
   msg_comm_t comm;
   unsigned int cursor;
   xbt_dynar_foreach(comms, cursor, comm) {
-    xbt_dynar_push(s_comms, &comm->s_comm);
+    intrusive_ptr_add_ref(comm->s_comm.get());
+    xbt_dynar_push_as(s_comms, simgrid::kernel::activity::ActivityImpl*, comm->s_comm.get());
   }
 
   msg_error_t status = MSG_OK;