xbt_os_mutex_acquire(simix_global->mutex);
/* cancel non-blocking communications */
- smx_activity_t synchro = process->comms.front();
while (not process->comms.empty()) {
+ smx_activity_t synchro = process->comms.front();
+ process->comms.pop_front();
simgrid::kernel::activity::CommImplPtr comm =
boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
} else {
xbt_die("Communication synchro %p is in my list but I'm not the sender nor the receiver", synchro.get());
}
- process->comms.pop_front();
- synchro = process->comms.front();
comm->cancel();
}
* The C API should first be properly replaced with the C++ one, which is a fair amount of work.
*/
intrusive_ptr_add_ref(process);
- SIMIX_process_on_exit(process, (int_f_pvoid_pvoid_t)SIMIX_process_join_finish, &*res);
+ SIMIX_process_on_exit(process,
+ [](void*, void* arg) {
+ return simgrid::simix::kernelImmediate(
+ [&] { return SIMIX_process_join_finish(SMX_EXIT_SUCCESS, arg); });
+ },
+ &*res);
return res;
}
/** @brief Returns the process from PID. */
smx_actor_t SIMIX_process_from_PID(aid_t PID)
{
- try {
- return simix_global->process_list.at(PID);
- } catch (std::out_of_range& unfound) {
- return nullptr;
- }
+ auto process = simix_global->process_list.find(PID);
+ return process == simix_global->process_list.end() ? nullptr : process->second;
}
/** @brief returns a dynar containing all currently existing processes */