From: Martin Quinson Date: Mon, 12 Aug 2019 09:37:10 +0000 (+0200) Subject: move the simcall template to the kernel::actor namespace X-Git-Tag: v3.24~196 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/92cd12d0b61dd5a17500ef7d38f7b95a80301037 move the simcall template to the kernel::actor namespace --- diff --git a/include/simgrid/simix.hpp b/include/simgrid/simix.hpp index 2b979d735d..f28dbb294e 100644 --- a/include/simgrid/simix.hpp +++ b/include/simgrid/simix.hpp @@ -20,7 +20,8 @@ XBT_PUBLIC void simcall_run_kernel(std::function const& code); XBT_PUBLIC void simcall_run_blocking(std::function const& code); namespace simgrid { -namespace simix { +namespace kernel { +namespace actor { /** Execute some code in kernel context on behalf of the user code. * @@ -86,6 +87,11 @@ template typename std::result_of::type simcall_blocking(F&& code) simcall_run_blocking([&result, &code] { simgrid::xbt::fulfill_promise(result, std::forward(code)); }); return result.get(); } +} // namespace actor +} // namespace kernel +} // namespace simgrid +namespace simgrid { +namespace simix { XBT_ATTRIB_DEPRECATED_v325("Please manifest if you actually need this function") XBT_PUBLIC const std::vector& process_get_runnable(); diff --git a/include/simgrid/simix/blocking_simcall.hpp b/include/simgrid/simix/blocking_simcall.hpp index 43565d3e62..c8ba0f746a 100644 --- a/include/simgrid/simix/blocking_simcall.hpp +++ b/include/simgrid/simix/blocking_simcall.hpp @@ -149,7 +149,7 @@ template auto kernel_async(F code) -> Future typedef decltype(code().get()) T; // Execute the code in the kernel and get the kernel future: - simgrid::kernel::Future future = simgrid::simix::simcall(std::move(code)); + simgrid::kernel::Future future = simgrid::kernel::actor::simcall(std::move(code)); // Wrap the kernel future in a actor future: return simgrid::simix::Future(std::move(future)); diff --git a/src/kernel/actor/ActorImpl.cpp b/src/kernel/actor/ActorImpl.cpp index 0d4521318d..8cd4120470 100644 --- a/src/kernel/actor/ActorImpl.cpp +++ b/src/kernel/actor/ActorImpl.cpp @@ -68,7 +68,7 @@ ActorImpl::~ActorImpl() if (simix_global != nullptr && this != simix_global->maestro_process) { if (context_.get() != nullptr) /* the actor was not start()ed yet. This happens if its host was initially off */ context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops - simgrid::simix::simcall([this] { simgrid::s4u::Actor::on_destruction(*ciface()); }); + simgrid::kernel::actor::simcall([this] { simgrid::s4u::Actor::on_destruction(*ciface()); }); if (context_.get() != nullptr) context_->iwannadie = true; } @@ -193,7 +193,7 @@ void ActorImpl::cleanup() simix_global->mutex.unlock(); context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops - simgrid::simix::simcall([this] { simgrid::s4u::Actor::on_termination(*ciface()); }); + simgrid::kernel::actor::simcall([this] { simgrid::s4u::Actor::on_termination(*ciface()); }); context_->iwannadie = true; } @@ -650,12 +650,12 @@ smx_actor_t simcall_process_create(const std::string& name, const simgrid::simix sg_host_t host, std::unordered_map* properties) { smx_actor_t self = SIMIX_process_self(); - return simgrid::simix::simcall([&name, &code, data, host, properties, self] { + return simgrid::kernel::actor::simcall([&name, &code, data, host, properties, self] { return simgrid::kernel::actor::ActorImpl::create(name, code, data, host, properties, self).get(); }); } void simcall_process_set_data(smx_actor_t process, void* data) { - simgrid::simix::simcall([process, data] { process->set_user_data(data); }); + simgrid::kernel::actor::simcall([process, data] { process->set_user_data(data); }); } diff --git a/src/plugins/host_energy.cpp b/src/plugins/host_energy.cpp index d85f0139f8..2dd43f54f3 100644 --- a/src/plugins/host_energy.cpp +++ b/src/plugins/host_energy.cpp @@ -334,7 +334,7 @@ double HostEnergy::get_current_watts_value(double cpu_load) double HostEnergy::get_consumed_energy() { if (last_updated_ < surf_get_clock()) // We need to simcall this as it modifies the environment - simgrid::simix::simcall(std::bind(&HostEnergy::update, this)); + simgrid::kernel::actor::simcall(std::bind(&HostEnergy::update, this)); return total_energy_; } @@ -517,7 +517,7 @@ void sg_host_energy_plugin_init() */ void sg_host_energy_update_all() { - simgrid::simix::simcall([]() { + simgrid::kernel::actor::simcall([]() { std::vector list = simgrid::s4u::Engine::get_instance()->get_all_hosts(); for (auto const& host : list) if (dynamic_cast(host) == nullptr) { // Ignore virtual machines diff --git a/src/plugins/link_energy.cpp b/src/plugins/link_energy.cpp index d6ff7970f4..bdf842b688 100644 --- a/src/plugins/link_energy.cpp +++ b/src/plugins/link_energy.cpp @@ -136,7 +136,7 @@ double LinkEnergy::get_power() double LinkEnergy::get_consumed_energy() { if (last_updated_ < surf_get_clock()) // We need to simcall this as it modifies the environment - simgrid::simix::simcall(std::bind(&LinkEnergy::update, this)); + simgrid::kernel::actor::simcall(std::bind(&LinkEnergy::update, this)); return this->total_energy_; } } // namespace plugin diff --git a/src/plugins/vm/s4u_VirtualMachine.cpp b/src/plugins/vm/s4u_VirtualMachine.cpp index 7dd96b893a..3cf72b4112 100644 --- a/src/plugins/vm/s4u_VirtualMachine.cpp +++ b/src/plugins/vm/s4u_VirtualMachine.cpp @@ -64,7 +64,7 @@ void VirtualMachine::start() { on_start(*this); - simgrid::simix::simcall([this]() { + simgrid::kernel::actor::simcall([this]() { simgrid::vm::VmHostExt::ensureVmExtInstalled(); simgrid::s4u::Host* pm = this->pimpl_vm_->get_physical_host(); @@ -101,7 +101,7 @@ void VirtualMachine::suspend() { on_suspend(*this); smx_actor_t issuer = SIMIX_process_self(); - simgrid::simix::simcall([this, issuer]() { pimpl_vm_->suspend(issuer); }); + simgrid::kernel::actor::simcall([this, issuer]() { pimpl_vm_->suspend(issuer); }); } void VirtualMachine::resume() @@ -113,7 +113,7 @@ void VirtualMachine::resume() void VirtualMachine::shutdown() { smx_actor_t issuer = SIMIX_process_self(); - simgrid::simix::simcall([this, issuer]() { pimpl_vm_->shutdown(issuer); }); + simgrid::kernel::actor::simcall([this, issuer]() { pimpl_vm_->shutdown(issuer); }); on_shutdown(*this); } @@ -133,12 +133,12 @@ simgrid::s4u::Host* VirtualMachine::get_pm() void VirtualMachine::set_pm(simgrid::s4u::Host* pm) { - simgrid::simix::simcall([this, pm]() { pimpl_vm_->set_physical_host(pm); }); + simgrid::kernel::actor::simcall([this, pm]() { pimpl_vm_->set_physical_host(pm); }); } VirtualMachine::state VirtualMachine::get_state() { - return simgrid::simix::simcall([this]() { return pimpl_vm_->get_state(); }); + return simgrid::kernel::actor::simcall([this]() { return pimpl_vm_->get_state(); }); } size_t VirtualMachine::get_ramsize() @@ -178,7 +178,7 @@ void VirtualMachine::set_ramsize(size_t ramsize) */ void VirtualMachine::set_bound(double bound) { - simgrid::simix::simcall([this, bound]() { pimpl_vm_->set_bound(bound); }); + simgrid::kernel::actor::simcall([this, bound]() { pimpl_vm_->set_bound(bound); }); } } // namespace simgrid diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 83e905fd82..4239ef2e40 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -46,13 +46,14 @@ Actor* Actor::self() ActorPtr Actor::init(const std::string& name, s4u::Host* host) { smx_actor_t self = SIMIX_process_self(); - kernel::actor::ActorImpl* actor = simix::simcall([self, &name, host] { return self->init(name, host).get(); }); + kernel::actor::ActorImpl* actor = + kernel::actor::simcall([self, &name, host] { return self->init(name, host).get(); }); return actor->iface(); } ActorPtr Actor::start(const std::function& code) { - simgrid::simix::simcall([this, &code] { pimpl_->start(code); }); + simgrid::kernel::actor::simcall([this, &code] { pimpl_->start(code); }); return this; } @@ -60,7 +61,7 @@ ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::func { smx_actor_t self = SIMIX_process_self(); kernel::actor::ActorImpl* actor = - simix::simcall([self, &name, host, &code] { return self->init(name, host)->start(code); }); + kernel::actor::simcall([self, &name, host, &code] { return self->init(name, host)->start(code); }); return actor->iface(); } @@ -96,7 +97,7 @@ void Actor::join(double timeout) { auto issuer = SIMIX_process_self(); auto target = pimpl_; - simix::simcall_blocking([issuer, target, timeout] { + kernel::actor::simcall_blocking([issuer, target, timeout] { if (target->finished_) { // The joined process is already finished, just wake up the issuer right away issuer->simcall_answer(); @@ -110,7 +111,7 @@ void Actor::join(double timeout) void Actor::set_auto_restart(bool autorestart) { - simix::simcall([this, autorestart]() { + kernel::actor::simcall([this, autorestart]() { xbt_assert(autorestart && not pimpl_->has_to_auto_restart()); // FIXME: handle all cases pimpl_->set_auto_restart(autorestart); @@ -127,14 +128,14 @@ void Actor::on_exit(const std::function& fun, void* data) /* d void Actor::on_exit(const std::function& fun) const { - simix::simcall([this, &fun] { SIMIX_process_on_exit(pimpl_, fun); }); + kernel::actor::simcall([this, &fun] { SIMIX_process_on_exit(pimpl_, fun); }); } void Actor::migrate(Host* new_host) { s4u::Actor::on_migration_start(*this); - simix::simcall([this, new_host]() { + kernel::actor::simcall([this, new_host]() { if (pimpl_->waiting_synchro != nullptr) { // The actor is blocked on an activity. If it's an exec, migrate it too. // FIXME: implement the migration of other kind of activities @@ -156,7 +157,7 @@ s4u::Host* Actor::get_host() const void Actor::daemonize() { - simix::simcall([this]() { pimpl_->daemonize(); }); + kernel::actor::simcall([this]() { pimpl_->daemonize(); }); } bool Actor::is_daemon() const @@ -189,7 +190,7 @@ void Actor::suspend() auto issuer = SIMIX_process_self(); auto target = pimpl_; s4u::Actor::on_suspend(*this); - simix::simcall_blocking([issuer, target]() { + kernel::actor::simcall_blocking([issuer, target]() { target->suspend(issuer); if (target != issuer) { /* If we are suspending ourselves, then just do not finish the simcall now */ @@ -200,7 +201,7 @@ void Actor::suspend() void Actor::resume() { - simix::simcall([this] { pimpl_->resume(); }); + kernel::actor::simcall([this] { pimpl_->resume(); }); s4u::Actor::on_resume(*this); } @@ -211,7 +212,7 @@ bool Actor::is_suspended() void Actor::set_kill_time(double kill_time) { - simix::simcall([this, kill_time] { pimpl_->set_kill_time(kill_time); }); + kernel::actor::simcall([this, kill_time] { pimpl_->set_kill_time(kill_time); }); } /** @brief Get the kill time of an actor(or 0 if unset). */ @@ -225,7 +226,7 @@ void Actor::kill(aid_t pid) // deprecated kernel::actor::ActorImpl* killer = SIMIX_process_self(); kernel::actor::ActorImpl* victim = SIMIX_process_from_PID(pid); if (victim != nullptr) { - simix::simcall([killer, victim] { killer->kill(victim); }); + kernel::actor::simcall([killer, victim] { killer->kill(victim); }); } else { std::ostringstream oss; oss << "kill: (" << pid << ") - No such actor" << std::endl; @@ -236,7 +237,7 @@ void Actor::kill(aid_t pid) // deprecated void Actor::kill() { kernel::actor::ActorImpl* process = SIMIX_process_self(); - simix::simcall([this, process] { + kernel::actor::simcall([this, process] { xbt_assert(pimpl_ != simix_global->maestro_process, "Killing maestro is a rather bad idea"); process->kill(pimpl_); }); @@ -256,7 +257,7 @@ ActorPtr Actor::by_pid(aid_t pid) void Actor::kill_all() { kernel::actor::ActorImpl* self = SIMIX_process_self(); - simix::simcall([self] { self->kill_all(); }); + kernel::actor::simcall([self] { self->kill_all(); }); } const std::unordered_map* Actor::get_properties() const @@ -272,12 +273,12 @@ const char* Actor::get_property(const std::string& key) const void Actor::set_property(const std::string& key, const std::string& value) { - simix::simcall([this, &key, &value] { pimpl_->set_property(key, value); }); + kernel::actor::simcall([this, &key, &value] { pimpl_->set_property(key, value); }); } Actor* Actor::restart() { - return simix::simcall([this]() { return pimpl_->restart(); }); + return kernel::actor::simcall([this]() { return pimpl_->restart(); }); } // ***** this_actor ***** @@ -307,7 +308,7 @@ void sleep_for(double duration) kernel::actor::ActorImpl* issuer = SIMIX_process_self(); Actor::on_sleep(*issuer->ciface()); - simix::simcall_blocking([issuer, duration]() { + kernel::actor::simcall_blocking([issuer, duration]() { if (MC_is_active() || MC_record_replay_is_active()) { MC_process_clock_add(issuer, duration); issuer->simcall_answer(); @@ -325,7 +326,7 @@ void sleep_for(double duration) void yield() { - simix::simcall([] { /* do nothing*/ }); + kernel::actor::simcall([] { /* do nothing*/ }); } XBT_PUBLIC void sleep_until(double wakeup_time) @@ -449,14 +450,14 @@ void suspend() void resume() { kernel::actor::ActorImpl* self = SIMIX_process_self(); - simix::simcall([self] { self->resume(); }); + kernel::actor::simcall([self] { self->resume(); }); Actor::on_resume(*self->ciface()); } void exit() { kernel::actor::ActorImpl* self = SIMIX_process_self(); - simgrid::simix::simcall([self] { self->exit(); }); + simgrid::kernel::actor::simcall([self] { self->exit(); }); } void on_exit(const std::function& fun) diff --git a/src/s4u/s4u_Comm.cpp b/src/s4u/s4u_Comm.cpp index 0c28a0bb58..730a6b4f29 100644 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@ -200,7 +200,7 @@ Comm* Comm::detach() Comm* Comm::cancel() { - simix::simcall([this] { + kernel::actor::simcall([this] { if (pimpl_) boost::static_pointer_cast(pimpl_)->cancel(); }); diff --git a/src/s4u/s4u_ConditionVariable.cpp b/src/s4u/s4u_ConditionVariable.cpp index 1656d7f43f..0e9683f9db 100644 --- a/src/s4u/s4u_ConditionVariable.cpp +++ b/src/s4u/s4u_ConditionVariable.cpp @@ -19,7 +19,7 @@ namespace s4u { ConditionVariablePtr ConditionVariable::create() { kernel::activity::ConditionVariableImpl* cond = - simix::simcall([] { return new kernel::activity::ConditionVariableImpl(); }); + kernel::actor::simcall([] { return new kernel::activity::ConditionVariableImpl(); }); return ConditionVariablePtr(&cond->cond_, false); } @@ -67,12 +67,12 @@ std::cv_status ConditionVariable::wait_until(std::unique_lock& lock, doub */ void ConditionVariable::notify_one() { - simgrid::simix::simcall([this]() { cond_->signal(); }); + simgrid::kernel::actor::simcall([this]() { cond_->signal(); }); } void ConditionVariable::notify_all() { - simgrid::simix::simcall([this]() { cond_->broadcast(); }); + simgrid::kernel::actor::simcall([this]() { cond_->broadcast(); }); } void intrusive_ptr_add_ref(ConditionVariable* cond) @@ -92,7 +92,7 @@ void intrusive_ptr_release(ConditionVariable* cond) sg_cond_t sg_cond_init() { simgrid::kernel::activity::ConditionVariableImpl* cond = - simgrid::simix::simcall([] { return new simgrid::kernel::activity::ConditionVariableImpl(); }); + simgrid::kernel::actor::simcall([] { return new simgrid::kernel::activity::ConditionVariableImpl(); }); return new simgrid::s4u::ConditionVariable(cond); } diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index 0c124e03f5..64cb7f62bd 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -351,7 +351,7 @@ std::vector Engine::get_all_netpoints() /** @brief Register a new netpoint to the system */ void Engine::netpoint_register(kernel::routing::NetPoint* point) { - // simgrid::simix::simcall([&]{ FIXME: this segfaults in set_thread + // simgrid::kernel::actor::simcall([&]{ FIXME: this segfaults in set_thread pimpl->netpoints_[point->get_name()] = point; // }); } @@ -359,7 +359,7 @@ void Engine::netpoint_register(kernel::routing::NetPoint* point) /** @brief Unregister a given netpoint */ void Engine::netpoint_unregister(kernel::routing::NetPoint* point) { - simix::simcall([this, point] { + kernel::actor::simcall([this, point] { pimpl->netpoints_.erase(point->get_name()); delete point; }); diff --git a/src/s4u/s4u_Exec.cpp b/src/s4u/s4u_Exec.cpp index 17fa93cd8a..48d7d4da31 100644 --- a/src/s4u/s4u_Exec.cpp +++ b/src/s4u/s4u_Exec.cpp @@ -63,7 +63,7 @@ int Exec::wait_any_for(std::vector* execs, double timeout) Exec* Exec::cancel() { - simix::simcall([this] { boost::static_pointer_cast(pimpl_)->cancel(); }); + kernel::actor::simcall([this] { boost::static_pointer_cast(pimpl_)->cancel(); }); state_ = State::CANCELED; return this; } @@ -134,7 +134,7 @@ ExecSeq::ExecSeq(sg_host_t host, double flops_amount) : Exec(), flops_amount_(fl Exec* ExecSeq::start() { - simix::simcall([this] { + kernel::actor::simcall([this] { (*boost::static_pointer_cast(pimpl_)) .set_name(name_) .set_tracing_category(tracing_category_) @@ -173,7 +173,7 @@ Host* ExecSeq::get_host() /** @brief Returns the amount of flops that remain to be done */ double ExecSeq::get_remaining() { - return simgrid::simix::simcall( + return simgrid::kernel::actor::simcall( [this]() { return boost::static_pointer_cast(pimpl_)->get_remaining(); }); } @@ -183,7 +183,7 @@ double ExecSeq::get_remaining() */ double ExecSeq::get_remaining_ratio() { - return simgrid::simix::simcall([this]() { + return simgrid::kernel::actor::simcall([this]() { return boost::static_pointer_cast(pimpl_)->get_seq_remaining_ratio(); }); } @@ -197,7 +197,7 @@ ExecPar::ExecPar(const std::vector& hosts, const std::vector Exec* ExecPar::start() { - simix::simcall([this] { + kernel::actor::simcall([this] { (*boost::static_pointer_cast(pimpl_)) .set_hosts(hosts_) .set_timeout(timeout_) @@ -212,7 +212,7 @@ Exec* ExecPar::start() double ExecPar::get_remaining_ratio() { - return simix::simcall( + return kernel::actor::simcall( [this]() { return boost::static_pointer_cast(pimpl_)->get_par_remaining_ratio(); }); } diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index db85aa3ec9..29eb24bf9f 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -87,7 +87,7 @@ Host* Host::current() void Host::turn_on() { if (not is_on()) { - simix::simcall([this] { + kernel::actor::simcall([this] { this->pimpl_cpu->turn_on(); this->pimpl_->turn_on(); on_state_change(*this); @@ -99,7 +99,7 @@ void Host::turn_on() void Host::turn_off() { if (is_on()) { - simix::simcall([this] { + kernel::actor::simcall([this] { for (VirtualMachine* const& vm : vm::VirtualMachineImpl::allVms_) if (vm->get_pm() == this) { vm->shutdown(); @@ -199,19 +199,19 @@ const char* Host::get_property(const std::string& key) const void Host::set_property(const std::string& key, const std::string& value) { - simix::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); + kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); } void Host::set_properties(const std::map& properties) { - simix::simcall([this, &properties] { this->pimpl_->set_properties(properties); }); + kernel::actor::simcall([this, &properties] { this->pimpl_->set_properties(properties); }); } /** Specify a profile turning the host on and off according to a exhaustive list or a stochastic law. * The profile must contain boolean values. */ void Host::set_state_profile(kernel::profile::Profile* p) { - return simix::simcall([this, p] { pimpl_cpu->set_state_profile(p); }); + return kernel::actor::simcall([this, p] { pimpl_cpu->set_state_profile(p); }); } /** Specify a profile modeling the external load according to a exhaustive list or a stochastic law. * @@ -221,7 +221,7 @@ void Host::set_state_profile(kernel::profile::Profile* p) */ void Host::set_speed_profile(kernel::profile::Profile* p) { - return simix::simcall([this, p] { pimpl_cpu->set_speed_profile(p); }); + return kernel::actor::simcall([this, p] { pimpl_cpu->set_speed_profile(p); }); } /** @brief Get the peak processor speed (in flops/s), at the specified pstate */ @@ -276,7 +276,7 @@ int Host::get_core_count() const /** @brief Set the pstate at which the host should run */ void Host::set_pstate(int pstate_index) { - simix::simcall([this, pstate_index] { this->pimpl_cpu->set_pstate(pstate_index); }); + kernel::actor::simcall([this, pstate_index] { this->pimpl_cpu->set_pstate(pstate_index); }); } /** @brief Retrieve the pstate at which the host is currently running */ int Host::get_pstate() const @@ -291,7 +291,7 @@ int Host::get_pstate() const */ std::vector Host::get_attached_storages() const { - return simix::simcall([this] { return this->pimpl_->get_attached_storages(); }); + return kernel::actor::simcall([this] { return this->pimpl_->get_attached_storages(); }); } std::unordered_map const& Host::get_mounted_storages() diff --git a/src/s4u/s4u_Io.cpp b/src/s4u/s4u_Io.cpp index 7a89c7b762..924dfec086 100644 --- a/src/s4u/s4u_Io.cpp +++ b/src/s4u/s4u_Io.cpp @@ -21,7 +21,7 @@ Io::Io(sg_storage_t storage, sg_size_t size, OpType type) : storage_(storage), s Io* Io::start() { - simix::simcall([this] { + kernel::actor::simcall([this] { (*boost::static_pointer_cast(pimpl_)) .set_name(name_) .set_storage(storage_->get_impl()) @@ -35,7 +35,7 @@ Io* Io::start() Io* Io::cancel() { - simgrid::simix::simcall([this] { boost::static_pointer_cast(pimpl_)->cancel(); }); + simgrid::kernel::actor::simcall([this] { boost::static_pointer_cast(pimpl_)->cancel(); }); state_ = State::CANCELED; return this; } @@ -70,13 +70,13 @@ bool Io::test() /** @brief Returns the amount of flops that remain to be done */ double Io::get_remaining() { - return simix::simcall( + return kernel::actor::simcall( [this]() { return boost::static_pointer_cast(pimpl_)->get_remaining(); }); } sg_size_t Io::get_performed_ioops() { - return simix::simcall( + return kernel::actor::simcall( [this]() { return boost::static_pointer_cast(pimpl_)->get_performed_ioops(); }); } diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index 866436c721..4fecbd4590 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -71,11 +71,11 @@ double Link::get_usage() void Link::turn_on() { - simgrid::simix::simcall([this]() { this->pimpl_->turn_on(); }); + simgrid::kernel::actor::simcall([this]() { this->pimpl_->turn_on(); }); } void Link::turn_off() { - simgrid::simix::simcall([this]() { this->pimpl_->turn_off(); }); + simgrid::kernel::actor::simcall([this]() { this->pimpl_->turn_off(); }); } bool Link::is_on() const @@ -89,20 +89,20 @@ void* Link::get_data() } void Link::set_data(void* d) { - simgrid::simix::simcall([this, d]() { this->pimpl_->set_data(d); }); + simgrid::kernel::actor::simcall([this, d]() { this->pimpl_->set_data(d); }); } void Link::set_state_profile(kernel::profile::Profile* profile) { - simgrid::simix::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); }); + simgrid::kernel::actor::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); }); } void Link::set_bandwidth_profile(kernel::profile::Profile* profile) { - simgrid::simix::simcall([this, profile]() { this->pimpl_->set_bandwidth_profile(profile); }); + simgrid::kernel::actor::simcall([this, profile]() { this->pimpl_->set_bandwidth_profile(profile); }); } void Link::set_latency_profile(kernel::profile::Profile* trace) { - simgrid::simix::simcall([this, trace]() { this->pimpl_->set_latency_profile(trace); }); + simgrid::kernel::actor::simcall([this, trace]() { this->pimpl_->set_latency_profile(trace); }); } const char* Link::get_property(const std::string& key) const @@ -111,7 +111,7 @@ const char* Link::get_property(const std::string& key) const } void Link::set_property(const std::string& key, const std::string& value) { - simgrid::simix::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); + simgrid::kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); } } // namespace s4u } // namespace simgrid diff --git a/src/s4u/s4u_Mailbox.cpp b/src/s4u/s4u_Mailbox.cpp index baa91b81ce..d9d6c6c97b 100644 --- a/src/s4u/s4u_Mailbox.cpp +++ b/src/s4u/s4u_Mailbox.cpp @@ -29,7 +29,7 @@ Mailbox* Mailbox::by_name(const std::string& name) { kernel::activity::MailboxImpl* mbox = kernel::activity::MailboxImpl::by_name_or_null(name); if (mbox == nullptr) { - mbox = simix::simcall([&name] { return kernel::activity::MailboxImpl::by_name_or_create(name); }); + mbox = kernel::actor::simcall([&name] { return kernel::activity::MailboxImpl::by_name_or_create(name); }); } return &mbox->piface_; } @@ -63,7 +63,7 @@ kernel::activity::CommImplPtr Mailbox::front() void Mailbox::set_receiver(ActorPtr actor) { - simix::simcall([this, actor]() { this->pimpl_->set_receiver(actor); }); + kernel::actor::simcall([this, actor]() { this->pimpl_->set_receiver(actor); }); } /** @brief get the receiver (process associated to the mailbox) */ @@ -152,7 +152,7 @@ void* Mailbox::get(double timeout) smx_activity_t Mailbox::iprobe(int type, int (*match_fun)(void*, void*, kernel::activity::CommImpl*), void* data) { - return simix::simcall([this, type, match_fun, data] { return pimpl_->iprobe(type, match_fun, data); }); + return kernel::actor::simcall([this, type, match_fun, data] { return pimpl_->iprobe(type, match_fun, data); }); } } // namespace s4u } // namespace simgrid diff --git a/src/s4u/s4u_Mutex.cpp b/src/s4u/s4u_Mutex.cpp index 95658bb9fc..6494276c9a 100644 --- a/src/s4u/s4u_Mutex.cpp +++ b/src/s4u/s4u_Mutex.cpp @@ -44,7 +44,7 @@ bool Mutex::try_lock() */ MutexPtr Mutex::create() { - kernel::activity::MutexImpl* mutex = simix::simcall([] { return new kernel::activity::MutexImpl(); }); + kernel::activity::MutexImpl* mutex = kernel::actor::simcall([] { return new kernel::activity::MutexImpl(); }); return MutexPtr(&mutex->mutex(), false); } @@ -69,7 +69,7 @@ void intrusive_ptr_release(Mutex* mutex) sg_mutex_t sg_mutex_init() { simgrid::kernel::activity::MutexImpl* mutex = - simgrid::simix::simcall([] { return new simgrid::kernel::activity::MutexImpl(); }); + simgrid::kernel::actor::simcall([] { return new simgrid::kernel::activity::MutexImpl(); }); return new simgrid::s4u::Mutex(mutex); } diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index 1576fae32e..dec17ec8aa 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -35,7 +35,7 @@ const char* NetZone::get_property(const std::string& key) const void NetZone::set_property(const std::string& key, const std::string& value) { - simix::simcall([this, &key, &value] { properties_[key] = value; }); + kernel::actor::simcall([this, &key, &value] { properties_[key] = value; }); } /** @brief Returns the list of direct children (no grand-children) */ diff --git a/src/s4u/s4u_Semaphore.cpp b/src/s4u/s4u_Semaphore.cpp index 8476633918..debf3ecda3 100644 --- a/src/s4u/s4u_Semaphore.cpp +++ b/src/s4u/s4u_Semaphore.cpp @@ -15,7 +15,7 @@ namespace s4u { Semaphore::Semaphore(unsigned int initial_capacity) { - sem_ = simix::simcall([initial_capacity] { return new kernel::activity::SemaphoreImpl(initial_capacity); }); + sem_ = kernel::actor::simcall([initial_capacity] { return new kernel::activity::SemaphoreImpl(initial_capacity); }); } Semaphore::~Semaphore() @@ -43,17 +43,17 @@ int Semaphore::acquire_timeout(double timeout) void Semaphore::release() { - simix::simcall([this] { sem_->release(); }); + kernel::actor::simcall([this] { sem_->release(); }); } int Semaphore::get_capacity() { - return simix::simcall([this] { return sem_->get_capacity(); }); + return kernel::actor::simcall([this] { return sem_->get_capacity(); }); } int Semaphore::would_block() { - return simix::simcall([this] { return sem_->would_block(); }); + return kernel::actor::simcall([this] { return sem_->would_block(); }); } void intrusive_ptr_add_ref(Semaphore* sem) diff --git a/src/s4u/s4u_Storage.cpp b/src/s4u/s4u_Storage.cpp index 8de6680859..08ad07863d 100644 --- a/src/s4u/s4u_Storage.cpp +++ b/src/s4u/s4u_Storage.cpp @@ -53,7 +53,7 @@ const char* Storage::get_property(const std::string& key) const void Storage::set_property(const std::string& key, const std::string& value) { - simix::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); + kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); } IoPtr Storage::io_init(sg_size_t size, Io::OpType type) diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 70b401484e..4a0aa0ef46 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -155,7 +155,7 @@ smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type, { xbt_assert(mbox, "No rendez-vous point defined for iprobe"); - return simgrid::simix::simcall([mbox, type, match_fun, data] { return mbox->iprobe(type, match_fun, data); }); + return simgrid::kernel::actor::simcall([mbox, type, match_fun, data] { return mbox->iprobe(type, match_fun, data); }); } /** @@ -225,7 +225,7 @@ smx_mutex_t simcall_mutex_init() // get there before the initialization xbt_abort(); } - return simgrid::simix::simcall([] { return new simgrid::kernel::activity::MutexImpl(); }); + return simgrid::kernel::actor::simcall([] { return new simgrid::kernel::activity::MutexImpl(); }); } /** @@ -261,7 +261,7 @@ void simcall_mutex_unlock(smx_mutex_t mutex) */ smx_cond_t simcall_cond_init() { - return simgrid::simix::simcall([] { return new simgrid::kernel::activity::ConditionVariableImpl(); }); + return simgrid::kernel::actor::simcall([] { return new simgrid::kernel::activity::ConditionVariableImpl(); }); } /** @@ -342,20 +342,22 @@ void unblock(smx_actor_t actor) /* ****************************DEPRECATED CALLS******************************* */ void simcall_process_set_kill_time(smx_actor_t process, double kill_time) { - simgrid::simix::simcall([process, kill_time] { process->set_kill_time(kill_time); }); + simgrid::kernel::actor::simcall([process, kill_time] { process->set_kill_time(kill_time); }); } void simcall_comm_cancel(smx_activity_t comm) { - simgrid::simix::simcall([comm] { boost::static_pointer_cast(comm)->cancel(); }); + simgrid::kernel::actor::simcall( + [comm] { boost::static_pointer_cast(comm)->cancel(); }); } void simcall_execution_cancel(smx_activity_t exec) { - simgrid::simix::simcall([exec] { boost::static_pointer_cast(exec)->cancel(); }); + simgrid::kernel::actor::simcall( + [exec] { boost::static_pointer_cast(exec)->cancel(); }); } void simcall_execution_set_bound(smx_activity_t exec, double bound) { - simgrid::simix::simcall( + simgrid::kernel::actor::simcall( [exec, bound] { boost::static_pointer_cast(exec)->set_bound(bound); }); } @@ -363,7 +365,7 @@ void simcall_execution_set_bound(smx_activity_t exec, double bound) smx_activity_t simcall_execution_start(const std::string& name, const std::string& category, double flops_amount, double sharing_penalty, double bound, sg_host_t host) { - return simgrid::simix::simcall([name, category, flops_amount, sharing_penalty, bound, host] { + return simgrid::kernel::actor::simcall([name, category, flops_amount, sharing_penalty, bound, host] { simgrid::kernel::activity::ExecImpl* exec = new simgrid::kernel::activity::ExecImpl(); (*exec) .set_name(name) @@ -409,7 +411,7 @@ smx_activity_t simcall_execution_parallel_start(const std::string& name, int hos flops_parallel_amount = std::vector(flops_amount, flops_amount + host_nb); if (bytes_amount != nullptr) bytes_parallel_amount = std::vector(bytes_amount, bytes_amount + host_nb * host_nb); - return simgrid::simix::simcall([name, hosts, flops_parallel_amount, bytes_parallel_amount, timeout] { + return simgrid::kernel::actor::simcall([name, hosts, flops_parallel_amount, bytes_parallel_amount, timeout] { simgrid::kernel::activity::ExecImpl* exec = new simgrid::kernel::activity::ExecImpl(); (*exec) .set_name(name) diff --git a/src/smpi/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index c05c46d063..663ac17434 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -124,7 +124,7 @@ int PMPI_Abort(MPI_Comm /*comm*/, int /*errorcode*/) smpi_bench_end(); // FIXME: should kill all processes in comm instead smx_actor_t actor = SIMIX_process_self(); - simgrid::simix::simcall([actor] { actor->exit(); }); + simgrid::kernel::actor::simcall([actor] { actor->exit(); }); return MPI_SUCCESS; } diff --git a/teshsuite/simix/generic-simcalls/generic-simcalls.cpp b/teshsuite/simix/generic-simcalls/generic-simcalls.cpp index 74cdbbed95..758b519d68 100644 --- a/teshsuite/simix/generic-simcalls/generic-simcalls.cpp +++ b/teshsuite/simix/generic-simcalls/generic-simcalls.cpp @@ -35,7 +35,7 @@ static void master() { // Test the simple immediate execution: XBT_INFO("Start"); - simgrid::simix::simcall([] { XBT_INFO("kernel"); }); + simgrid::kernel::actor::simcall([] { XBT_INFO("kernel"); }); XBT_INFO("kernel, returned"); // Synchronize on a successful Future: