simix_global->process_list.erase(process->pid);
if (process->host && process->host_process_list_hook.is_linked())
simgrid::xbt::intrusive_erase(process->host->extension<simgrid::simix::Host>()->process_list, *process);
- if (not xbt_swag_belongs(process, simix_global->process_to_destroy)) {
+ if (not process->smx_destroy_list_hook.is_linked()) {
#if SIMGRID_HAVE_MC
xbt_dynar_push_as(simix_global->dead_actors_vector, smx_actor_t, process);
#endif
- xbt_swag_insert(process, simix_global->process_to_destroy);
+ simix_global->process_to_destroy.push_back(*process);
}
process->context->iwannadie = 0;
*/
void SIMIX_process_empty_trash()
{
- smx_actor_t process = static_cast<smx_actor_t>(xbt_swag_extract(simix_global->process_to_destroy));
-
- while (process) {
+ while (not simix_global->process_to_destroy.empty()) {
+ smx_actor_t process = &simix_global->process_to_destroy.front();
+ simix_global->process_to_destroy.pop_front();
XBT_DEBUG("Getting rid of %p",process);
intrusive_ptr_release(process);
- process = static_cast<smx_actor_t>(xbt_swag_extract(simix_global->process_to_destroy));
}
#if SIMGRID_HAVE_MC
xbt_dynar_reset(simix_global->dead_actors_vector);
#include "simgrid/s4u/Actor.hpp"
#include "src/simix/popping_private.hpp"
#include "src/surf/PropertyHolder.hpp"
-#include "xbt/swag.h"
#include <boost/intrusive/list.hpp>
#include <list>
#include <map>
ActorImpl() : piface_(this) {}
~ActorImpl();
- // TODO, replace with boost intrusive container hooks (src/mc/mc_smx.cpp needs to be changed too)
- s_xbt_swag_hookup_t destroy_hookup = { nullptr, nullptr }; /* simix_global->process_to_destroy */
boost::intrusive::list_member_hook<> host_process_list_hook; /* simgrid::simix::Host::process_list */
+ boost::intrusive::list_member_hook<> smx_destroy_list_hook; /* simix_global->process_to_destroy */
boost::intrusive::list_member_hook<> smx_synchro_hook; /* {mutex,cond,sem}->sleeping */
aid_t pid = 0;
simix_global = std::unique_ptr<simgrid::simix::Global>(new simgrid::simix::Global());
simgrid::simix::ActorImpl proc;
- simix_global->process_to_destroy = xbt_swag_new(xbt_swag_offset(proc, destroy_hookup));
simix_global->maestro_process = nullptr;
simix_global->create_process_function = &SIMIX_process_create;
simix_global->kill_process_function = &kill_process;
/* Free the remaining data structures */
simix_global->process_to_run.clear();
simix_global->process_that_ran.clear();
- xbt_swag_free(simix_global->process_to_destroy);
+ simix_global->process_to_destroy.clear();
simix_global->process_list.clear();
- simix_global->process_to_destroy = nullptr;
xbt_os_mutex_destroy(simix_global->mutex);
simix_global->mutex = nullptr;
#include "src/kernel/context/Context.hpp"
#include <csignal>
+#include <boost/intrusive/list.hpp>
#include <map>
#include <vector>
std::vector<smx_actor_t> process_to_run;
std::vector<smx_actor_t> process_that_ran;
std::map<aid_t, smx_actor_t> process_list;
- xbt_swag_t process_to_destroy = nullptr;
+ boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>,
+ &ActorImpl::smx_destroy_list_hook>>
+ process_to_destroy;
#if SIMGRID_HAVE_MC
/* MCer cannot read members process_list and process_to_destroy above in the remote process, so we copy the info it
* needs in a dynar.