X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4775ee0f232bccc4978dfbfb8153b7593be7dd77..956cb23848021301bcb4c20fd31675f65e4348e5:/src/simix/ActorImpl.hpp diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index 3d7285f148..0fd300ad45 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2017. 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. */ @@ -7,17 +7,16 @@ #define SIMIX_ACTORIMPL_H #include "simgrid/s4u/Actor.hpp" -#include "src/simix/popping_private.h" +#include "src/simix/popping_private.hpp" #include "src/surf/PropertyHolder.hpp" -#include "xbt/swag.h" +#include #include #include -typedef struct s_smx_process_exit_fun { +struct s_smx_process_exit_fun_t { int_f_pvoid_pvoid_t fun; void *arg; -} s_smx_process_exit_fun_t; -typedef s_smx_process_exit_fun_t* smx_process_exit_fun_t; +}; namespace simgrid { namespace simix { @@ -29,7 +28,7 @@ public: void *data = nullptr; sg_host_t host = nullptr; double kill_time = 0.0; - std::map* properties = nullptr; + std::shared_ptr> properties; bool auto_restart = false; }; @@ -38,16 +37,15 @@ public: ActorImpl() : piface_(this) {} ~ActorImpl(); - // TODO, replace with boost intrusive container hooks - s_xbt_swag_hookup_t process_hookup = { nullptr, nullptr }; /* simix_global->process_list */ - s_xbt_swag_hookup_t synchro_hookup = { nullptr, nullptr }; /* {mutex,cond,sem}->sleeping */ - s_xbt_swag_hookup_t host_proc_hookup = { nullptr, nullptr }; /* smx_host->process_lis */ - 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; aid_t ppid = -1; simgrid::xbt::string name; - const char* cname() { return name.c_str(); } + const simgrid::xbt::string& getName() const { return name; } + const char* getCname() const { return name.c_str(); } s4u::Host* host = nullptr; /* the host on which the process is running */ smx_context_t context = nullptr; /* the context (uctx/raw/thread) that executes the user function */ @@ -115,6 +113,10 @@ public: void* getUserData() { return userdata; } }; +/* Used to keep the list of actors blocked on a synchro */ +typedef boost::intrusive::list, + &ActorImpl::smx_synchro_hook>> + SynchroList; } } @@ -122,7 +124,7 @@ typedef simgrid::simix::ProcessArg *smx_process_arg_t; typedef simgrid::simix::ActorImpl* smx_actor_t; -SG_BEGIN_DECL() +extern "C" { XBT_PRIVATE smx_actor_t SIMIX_process_create(const char* name, std::function code, void* data, sg_host_t host, std::map* properties, @@ -142,8 +144,7 @@ XBT_PRIVATE smx_actor_t SIMIX_process_get_by_name(const char* name); XBT_PRIVATE void SIMIX_process_auto_restart_set(smx_actor_t process, int auto_restart); extern void (*SMPI_switch_data_segment)(int dest); - -SG_END_DECL() +} XBT_PRIVATE void SIMIX_process_sleep_destroy(smx_activity_t synchro); XBT_PRIVATE smx_activity_t SIMIX_process_join(smx_actor_t issuer, smx_actor_t process, double timeout);