From 21f6e059a47df7875f1dacf26ca1eb854f4e887b Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 27 Feb 2022 23:04:00 +0100 Subject: [PATCH] Rename sg::k::actor::simcall ::actor::simcall_answered --- include/simgrid/simix.hpp | 8 ++--- src/kernel/actor/ActorImpl.cpp | 2 +- src/mc/mc_base.cpp | 2 +- src/plugins/file_system/s4u_FileSystem.cpp | 10 +++--- src/plugins/host_energy.cpp | 4 +-- src/plugins/link_energy.cpp | 2 +- src/s4u/s4u_Activity.cpp | 7 ++-- src/s4u/s4u_Actor.cpp | 30 ++++++++-------- src/s4u/s4u_Comm.cpp | 8 +++-- src/s4u/s4u_ConditionVariable.cpp | 6 ++-- src/s4u/s4u_Disk.cpp | 22 ++++++------ src/s4u/s4u_Engine.cpp | 12 +++---- src/s4u/s4u_Exec.cpp | 24 ++++++------- src/s4u/s4u_Host.cpp | 34 +++++++++---------- src/s4u/s4u_Io.cpp | 14 ++++---- src/s4u/s4u_Link.cpp | 24 ++++++------- src/s4u/s4u_Mailbox.cpp | 5 +-- src/s4u/s4u_Mutex.cpp | 9 ++--- src/s4u/s4u_Netzone.cpp | 14 ++++---- src/s4u/s4u_Semaphore.cpp | 6 ++-- src/s4u/s4u_VirtualMachine.cpp | 14 ++++---- src/simix/libsmx.cpp | 12 ++++--- src/smpi/bindings/smpi_pmpi.cpp | 4 +-- src/smpi/mpi/smpi_request.cpp | 12 ++++--- .../simcall-generic/blocking_simcall.hpp | 2 +- .../simcall-generic/simcall-generic.cpp | 2 +- 26 files changed, 149 insertions(+), 140 deletions(-) diff --git a/include/simgrid/simix.hpp b/include/simgrid/simix.hpp index c9902637d6..76e1f8fb85 100644 --- a/include/simgrid/simix.hpp +++ b/include/simgrid/simix.hpp @@ -15,8 +15,8 @@ #include #include -XBT_PUBLIC void simcall_run_kernel(std::function const& code, - simgrid::kernel::actor::SimcallObserver* observer); +XBT_PUBLIC void simcall_run_answered(std::function const& code, + simgrid::kernel::actor::SimcallObserver* observer); XBT_PUBLIC void simcall_run_blocking(std::function const& code, simgrid::kernel::actor::SimcallObserver* observer); @@ -43,7 +43,7 @@ namespace actor { * you may need to wait for that mutex to be unlocked by its current owner. * Potentially blocking simcall must be issued using simcall_blocking(), right below in this file. */ -template typename std::result_of_t simcall(F&& code, SimcallObserver* observer = nullptr) +template typename std::result_of_t simcall_answered(F&& code, SimcallObserver* observer = nullptr) { // If we are in the maestro, we take the fast path and execute the // code directly without simcall marshalling/unmarshalling/dispatch: @@ -55,7 +55,7 @@ template typename std::result_of_t simcall(F&& code, SimcallObser // conveniently handles the success/failure value for us. using R = typename std::result_of_t; simgrid::xbt::Result result; - simcall_run_kernel([&result, &code] { simgrid::xbt::fulfill_promise(result, std::forward(code)); }, observer); + simcall_run_answered([&result, &code] { simgrid::xbt::fulfill_promise(result, std::forward(code)); }, observer); return result.get(); } diff --git a/src/kernel/actor/ActorImpl.cpp b/src/kernel/actor/ActorImpl.cpp index 4e120568d8..a6fef78569 100644 --- a/src/kernel/actor/ActorImpl.cpp +++ b/src/kernel/actor/ActorImpl.cpp @@ -189,7 +189,7 @@ void ActorImpl::cleanup() cleanup_from_simix(); context_->set_wannadie(false); // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops - actor::simcall([this] { s4u::Actor::on_termination(*get_ciface()); }); + actor::simcall_answered([this] { s4u::Actor::on_termination(*get_ciface()); }); context_->set_wannadie(); } diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index 9ecb0de56d..6ffa2c5051 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -34,7 +34,7 @@ int MC_random(int min, int max) return prng.uniform_int(min, max); } simgrid::kernel::actor::RandomSimcall observer{simgrid::kernel::actor::ActorImpl::self(), min, max}; - return simgrid::kernel::actor::simcall([&observer] { return observer.get_value(); }, &observer); + return simgrid::kernel::actor::simcall_answered([&observer] { return observer.get_value(); }, &observer); } namespace simgrid { diff --git a/src/plugins/file_system/s4u_FileSystem.cpp b/src/plugins/file_system/s4u_FileSystem.cpp index 51d3ccc28c..75686e578f 100644 --- a/src/plugins/file_system/s4u_FileSystem.cpp +++ b/src/plugins/file_system/s4u_FileSystem.cpp @@ -71,7 +71,7 @@ File::File(const std::string& fullpath, void* userdata) : File(fullpath, Host::c File::File(const std::string& fullpath, const_sg_host_t host, void* userdata) : fullpath_(fullpath) { - kernel::actor::simcall([this, &host, userdata] { + kernel::actor::simcall_answered([this, &host, userdata] { this->set_data(userdata); // this cannot fail because we get a xbt_die if the mountpoint does not exist local_disk_ = find_local_disk_on(host); @@ -108,7 +108,7 @@ File::~File() { std::vector* desc_table = Host::current()->extension()->file_descriptor_table.get(); - kernel::actor::simcall([this, desc_table] { desc_table->push_back(this->desc_id); }); + kernel::actor::simcall_answered([this, desc_table] { desc_table->push_back(this->desc_id); }); } File* File::open(const std::string& fullpath, void* userdata) @@ -193,7 +193,7 @@ sg_size_t File::write(sg_size_t size, bool write_inside) if (current_position_ > size_) size_ = current_position_; } - kernel::actor::simcall([this] { + kernel::actor::simcall_answered([this] { std::map>* content = local_disk_->extension()->get_content(); content->erase(path_); @@ -379,12 +379,12 @@ std::map>* FileSystemDiskExt::parse_content( void FileSystemDiskExt::decr_used_size(sg_size_t size) { - simgrid::kernel::actor::simcall([this, size] { used_size_ -= size; }); + simgrid::kernel::actor::simcall_answered([this, size] { used_size_ -= size; }); } void FileSystemDiskExt::incr_used_size(sg_size_t size) { - simgrid::kernel::actor::simcall([this, size] { used_size_ += size; }); + simgrid::kernel::actor::simcall_answered([this, size] { used_size_ += size; }); } } } diff --git a/src/plugins/host_energy.cpp b/src/plugins/host_energy.cpp index 4fbb275e71..ef191bfd51 100644 --- a/src/plugins/host_energy.cpp +++ b/src/plugins/host_energy.cpp @@ -333,7 +333,7 @@ double HostEnergy::get_current_watts_value(double cpu_load) const double HostEnergy::get_consumed_energy() { if (last_updated_ < simgrid::s4u::Engine::get_clock()) // We need to simcall this as it modifies the environment - simgrid::kernel::actor::simcall(std::bind(&HostEnergy::update, this)); + simgrid::kernel::actor::simcall_answered(std::bind(&HostEnergy::update, this)); return total_energy_; } @@ -509,7 +509,7 @@ void sg_host_energy_plugin_init() */ void sg_host_energy_update_all() { - simgrid::kernel::actor::simcall([]() { + simgrid::kernel::actor::simcall_answered([]() { 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 23f6de0c39..50464200d0 100644 --- a/src/plugins/link_energy.cpp +++ b/src/plugins/link_energy.cpp @@ -138,7 +138,7 @@ double LinkEnergy::get_power() const double LinkEnergy::get_consumed_energy() { if (last_updated_ < simgrid::s4u::Engine::get_clock()) // We need to simcall this as it modifies the environment - kernel::actor::simcall(std::bind(&LinkEnergy::update, this)); + kernel::actor::simcall_answered(std::bind(&LinkEnergy::update, this)); return this->total_energy_; } } // namespace plugin diff --git a/src/s4u/s4u_Activity.cpp b/src/s4u/s4u_Activity.cpp index 15111b80d1..dcc650de45 100644 --- a/src/s4u/s4u_Activity.cpp +++ b/src/s4u/s4u_Activity.cpp @@ -84,7 +84,8 @@ bool Activity::test() kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); kernel::actor::ActivityTestSimcall observer{issuer, pimpl_.get()}; - if (kernel::actor::simcall([&observer] { return observer.get_activity()->test(observer.get_issuer()); }, &observer)) { + if (kernel::actor::simcall_answered([&observer] { return observer.get_activity()->test(observer.get_issuer()); }, + &observer)) { complete(State::FINISHED); return true; } @@ -99,7 +100,7 @@ ssize_t Activity::test_any(const std::vector& activities) kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); kernel::actor::ActivityTestanySimcall observer{issuer, ractivities}; - ssize_t changed_pos = kernel::actor::simcall( + ssize_t changed_pos = kernel::actor::simcall_answered( [&observer] { return kernel::activity::ActivityImpl::test_any(observer.get_issuer(), observer.get_activities()); }, @@ -130,7 +131,7 @@ ssize_t Activity::wait_any_for(const std::vector& activities, doubl Activity* Activity::cancel() { - kernel::actor::simcall([this] { + kernel::actor::simcall_answered([this] { XBT_HERE(); if (pimpl_) pimpl_->cancel(); diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 576f0b14c7..605a4c687f 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -51,7 +51,7 @@ ActorPtr Actor::init(const std::string& name, s4u::Host* host) { const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self(); kernel::actor::ActorImpl* actor = - kernel::actor::simcall([self, &name, host] { return self->init(name, host).get(); }); + kernel::actor::simcall_answered([self, &name, host] { return self->init(name, host).get(); }); return actor->get_iface(); } @@ -66,7 +66,7 @@ ActorPtr Actor::set_stacksize(unsigned stacksize) ActorPtr Actor::start(const std::function& code) { - simgrid::kernel::actor::simcall([this, &code] { pimpl_->start(code); }); + simgrid::kernel::actor::simcall_answered([this, &code] { pimpl_->start(code); }); return this; } @@ -74,7 +74,7 @@ ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::func { const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self(); kernel::actor::ActorImpl* actor = - kernel::actor::simcall([self, &name, host, &code] { return self->init(name, host)->start(code); }); + kernel::actor::simcall_answered([self, &name, host, &code] { return self->init(name, host)->start(code); }); return actor->get_iface(); } @@ -124,7 +124,7 @@ void Actor::join(double timeout) const Actor* Actor::set_auto_restart(bool autorestart) { - kernel::actor::simcall([this, autorestart]() { + kernel::actor::simcall_answered([this, autorestart]() { xbt_assert(autorestart && not pimpl_->has_to_auto_restart()); // FIXME: handle all cases pimpl_->set_auto_restart(autorestart); @@ -137,14 +137,14 @@ Actor* Actor::set_auto_restart(bool autorestart) void Actor::on_exit(const std::function& fun) const { - kernel::actor::simcall([this, &fun] { pimpl_->on_exit->emplace_back(fun); }); + kernel::actor::simcall_answered([this, &fun] { pimpl_->on_exit->emplace_back(fun); }); } void Actor::set_host(Host* new_host) { const s4u::Host* previous_location = get_host(); - kernel::actor::simcall([this, new_host]() { + kernel::actor::simcall_answered([this, new_host]() { for (auto const& activity : pimpl_->activities_) { // FIXME: implement the migration of other kinds of activities if (auto exec = boost::dynamic_pointer_cast(activity)) @@ -163,7 +163,7 @@ s4u::Host* Actor::get_host() const Actor* Actor::daemonize() { - kernel::actor::simcall([this]() { pimpl_->daemonize(); }); + kernel::actor::simcall_answered([this]() { pimpl_->daemonize(); }); return this; } @@ -214,7 +214,7 @@ void Actor::suspend() void Actor::resume() { - kernel::actor::simcall([this] { pimpl_->resume(); }); + kernel::actor::simcall_answered([this] { pimpl_->resume(); }); s4u::Actor::on_resume(*this); } @@ -225,7 +225,7 @@ bool Actor::is_suspended() const void Actor::set_kill_time(double kill_time) { - kernel::actor::simcall([this, kill_time] { pimpl_->set_kill_time(kill_time); }); + kernel::actor::simcall_answered([this, kill_time] { pimpl_->set_kill_time(kill_time); }); } /** @brief Get the kill time of an actor(or 0 if unset). */ @@ -237,7 +237,7 @@ double Actor::get_kill_time() const void Actor::kill() { const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self(); - kernel::actor::simcall([this, self] { self->kill(pimpl_); }); + kernel::actor::simcall_answered([this, self] { self->kill(pimpl_); }); } // ***** Static functions ***** @@ -254,7 +254,7 @@ ActorPtr Actor::by_pid(aid_t pid) void Actor::kill_all() { const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self(); - kernel::actor::simcall([self] { self->kill_all(); }); + kernel::actor::simcall_answered([self] { self->kill_all(); }); } const std::unordered_map* Actor::get_properties() const @@ -270,12 +270,12 @@ const char* Actor::get_property(const std::string& key) const void Actor::set_property(const std::string& key, const std::string& value) { - kernel::actor::simcall([this, &key, &value] { pimpl_->set_property(key, value); }); + kernel::actor::simcall_answered([this, &key, &value] { pimpl_->set_property(key, value); }); } Actor* Actor::restart() { - return kernel::actor::simcall([this]() { return pimpl_->restart(); }); + return kernel::actor::simcall_answered([this]() { return pimpl_->restart(); }); } // ***** this_actor ***** @@ -332,7 +332,7 @@ void sleep_for(double duration) void yield() { - kernel::actor::simcall([] { /* do nothing*/ }); + kernel::actor::simcall_answered([] { /* do nothing*/ }); } XBT_PUBLIC void sleep_until(double wakeup_time) @@ -431,7 +431,7 @@ void suspend() void exit() { kernel::actor::ActorImpl* self = simgrid::kernel::actor::ActorImpl::self(); - simgrid::kernel::actor::simcall([self] { self->exit(); }); + simgrid::kernel::actor::simcall_answered([self] { self->exit(); }); THROW_IMPOSSIBLE; } diff --git a/src/s4u/s4u_Comm.cpp b/src/s4u/s4u_Comm.cpp index e834664a98..69421d9a1e 100644 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@ -212,7 +212,7 @@ Comm* Comm::start() xbt_assert(from_ != nullptr && to_ != nullptr, "When either from_ or to_ is specified, both must be."); xbt_assert(src_buff_ == nullptr && dst_buff_ == nullptr, "Direct host-to-host communications cannot carry any data."); - pimpl_ = kernel::actor::simcall([this] { + pimpl_ = kernel::actor::simcall_answered([this] { kernel::activity::CommImplPtr res(new kernel::activity::CommImpl(this->from_, this->to_, this->get_remaining())); res->start(); return res; @@ -231,7 +231,8 @@ Comm* Comm::start() copy_data_function_, get_data(), detached_}; - pimpl_ = kernel::actor::simcall([&observer] { return kernel::activity::CommImpl::isend(&observer); }, &observer); + pimpl_ = kernel::actor::simcall_answered([&observer] { return kernel::activity::CommImpl::isend(&observer); }, + &observer); } else if (dst_buff_ != nullptr) { // Receiver side xbt_assert(not detached_, "Receive cannot be detached"); on_recv(*this); @@ -243,7 +244,8 @@ Comm* Comm::start() copy_data_function_, get_data(), rate_}; - pimpl_ = kernel::actor::simcall([&observer] { return kernel::activity::CommImpl::irecv(&observer); }, &observer); + pimpl_ = kernel::actor::simcall_answered([&observer] { return kernel::activity::CommImpl::irecv(&observer); }, + &observer); } else { xbt_die("Cannot start a communication before specifying whether we are the sender or the receiver"); } diff --git a/src/s4u/s4u_ConditionVariable.cpp b/src/s4u/s4u_ConditionVariable.cpp index 1e654dd515..6ad846cffc 100644 --- a/src/s4u/s4u_ConditionVariable.cpp +++ b/src/s4u/s4u_ConditionVariable.cpp @@ -18,7 +18,7 @@ namespace s4u { ConditionVariablePtr ConditionVariable::create() { kernel::activity::ConditionVariableImpl* cond = - kernel::actor::simcall([] { return new kernel::activity::ConditionVariableImpl(); }); + kernel::actor::simcall_answered([] { return new kernel::activity::ConditionVariableImpl(); }); return ConditionVariablePtr(cond->get_iface(), false); } @@ -77,12 +77,12 @@ std::cv_status ConditionVariable::wait_until(const std::unique_lock& lock */ void ConditionVariable::notify_one() { - simgrid::kernel::actor::simcall([this]() { pimpl_->signal(); }); + simgrid::kernel::actor::simcall_answered([this]() { pimpl_->signal(); }); } void ConditionVariable::notify_all() { - simgrid::kernel::actor::simcall([this]() { pimpl_->broadcast(); }); + simgrid::kernel::actor::simcall_answered([this]() { pimpl_->broadcast(); }); } void intrusive_ptr_add_ref(const ConditionVariable* cond) diff --git a/src/s4u/s4u_Disk.cpp b/src/s4u/s4u_Disk.cpp index b95164d7c1..fa64f72061 100644 --- a/src/s4u/s4u_Disk.cpp +++ b/src/s4u/s4u_Disk.cpp @@ -31,13 +31,13 @@ const char* Disk::get_cname() const Disk* Disk::set_read_bandwidth(double read_bw) { - kernel::actor::simcall([this, read_bw] { pimpl_->set_read_bandwidth(read_bw); }); + kernel::actor::simcall_answered([this, read_bw] { pimpl_->set_read_bandwidth(read_bw); }); return this; } Disk* Disk::set_write_bandwidth(double write_bw) { - kernel::actor::simcall([this, write_bw] { pimpl_->set_write_bandwidth(write_bw); }); + kernel::actor::simcall_answered([this, write_bw] { pimpl_->set_write_bandwidth(write_bw); }); return this; } @@ -48,7 +48,7 @@ double Disk::get_read_bandwidth() const Disk* Disk::set_readwrite_bandwidth(double bw) { - kernel::actor::simcall([this, bw] { pimpl_->set_readwrite_bandwidth(bw); }); + kernel::actor::simcall_answered([this, bw] { pimpl_->set_readwrite_bandwidth(bw); }); return this; } @@ -80,34 +80,34 @@ const char* Disk::get_property(const std::string& key) const Disk* Disk::set_property(const std::string& key, const std::string& value) { - kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); + kernel::actor::simcall_answered([this, &key, &value] { this->pimpl_->set_property(key, value); }); return this; } Disk* Disk::set_properties(const std::unordered_map& properties) { - kernel::actor::simcall([this, properties] { this->pimpl_->set_properties(properties); }); + kernel::actor::simcall_answered([this, properties] { this->pimpl_->set_properties(properties); }); return this; } Disk* Disk::set_state_profile(kernel::profile::Profile* profile) { xbt_assert(not pimpl_->is_sealed(), "Cannot set a state profile once the Disk is sealed"); - kernel::actor::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); }); + kernel::actor::simcall_answered([this, profile]() { this->pimpl_->set_state_profile(profile); }); return this; } Disk* Disk::set_read_bandwidth_profile(kernel::profile::Profile* profile) { xbt_assert(not pimpl_->is_sealed(), "Cannot set a bandwidth profile once the Disk is sealed"); - kernel::actor::simcall([this, profile]() { this->pimpl_->set_read_bandwidth_profile(profile); }); + kernel::actor::simcall_answered([this, profile]() { this->pimpl_->set_read_bandwidth_profile(profile); }); return this; } Disk* Disk::set_write_bandwidth_profile(kernel::profile::Profile* profile) { xbt_assert(not pimpl_->is_sealed(), "Cannot set a bandwidth profile once the Disk is sealed"); - kernel::actor::simcall([this, profile]() { this->pimpl_->set_write_bandwidth_profile(profile); }); + kernel::actor::simcall_answered([this, profile]() { this->pimpl_->set_write_bandwidth_profile(profile); }); return this; } @@ -156,7 +156,7 @@ sg_size_t Disk::write(sg_size_t size, double priority) const Disk* Disk::set_sharing_policy(Disk::Operation op, Disk::SharingPolicy policy, const NonLinearResourceCb& cb) { - kernel::actor::simcall([this, op, policy, &cb] { pimpl_->set_sharing_policy(op, policy, cb); }); + kernel::actor::simcall_answered([this, op, policy, &cb] { pimpl_->set_sharing_policy(op, policy, cb); }); return this; } @@ -167,13 +167,13 @@ Disk::SharingPolicy Disk::get_sharing_policy(Operation op) const Disk* Disk::set_factor_cb(const std::function& cb) { - kernel::actor::simcall([this, &cb] { pimpl_->set_factor_cb(cb); }); + kernel::actor::simcall_answered([this, &cb] { pimpl_->set_factor_cb(cb); }); return this; } Disk* Disk::seal() { - kernel::actor::simcall([this]{ pimpl_->seal(); }); + kernel::actor::simcall_answered([this] { pimpl_->seal(); }); Disk::on_creation(*this); // notify the signal return this; } diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index 5fc537aab7..8baf07d2d8 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -94,7 +94,7 @@ double Engine::get_clock() void Engine::add_model(std::shared_ptr model, const std::vector& dependencies) { - kernel::actor::simcall([this, &model, &dependencies] { pimpl->add_model(std::move(model), dependencies); }); + kernel::actor::simcall_answered([this, &model, &dependencies] { pimpl->add_model(std::move(model), dependencies); }); } const std::vector& Engine::get_all_models() const @@ -152,12 +152,12 @@ void Engine::register_default(const std::function& code) } void Engine::register_default(const kernel::actor::ActorCodeFactory& code) { - simgrid::kernel::actor::simcall([this, &code]() { pimpl->register_default(code); }); + simgrid::kernel::actor::simcall_answered([this, &code]() { pimpl->register_default(code); }); } void Engine::register_function(const std::string& name, const kernel::actor::ActorCodeFactory& code) { - simgrid::kernel::actor::simcall([this, name, &code]() { pimpl->register_function(name, code); }); + simgrid::kernel::actor::simcall_answered([this, name, &code]() { pimpl->register_function(name, code); }); } /** Load a deployment file and launch the actors that it contains @@ -256,7 +256,7 @@ Link* Engine::link_by_name_or_null(const std::string& name) const Mailbox* Engine::mailbox_by_name_or_create(const std::string& name) const { /* two actors may have pushed the same mbox_create simcall at the same time */ - kernel::activity::MailboxImpl* mbox = kernel::actor::simcall([&name, this] { + kernel::activity::MailboxImpl* mbox = kernel::actor::simcall_answered([&name, this] { auto m = pimpl->mailboxes_.emplace(name, nullptr); if (m.second) { m.first->second = new kernel::activity::MailboxImpl(name); @@ -410,13 +410,13 @@ std::vector Engine::get_all_netpoints() const /** @brief Register a new netpoint to the system */ void Engine::netpoint_register(kernel::routing::NetPoint* point) { - simgrid::kernel::actor::simcall([this, point] { pimpl->netpoints_[point->get_name()] = point; }); + simgrid::kernel::actor::simcall_answered([this, point] { pimpl->netpoints_[point->get_name()] = point; }); } /** @brief Unregister a given netpoint */ void Engine::netpoint_unregister(kernel::routing::NetPoint* point) { - kernel::actor::simcall([this, point] { + kernel::actor::simcall_answered([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 14f8e74dcf..8f5ec426a5 100644 --- a/src/s4u/s4u_Exec.cpp +++ b/src/s4u/s4u_Exec.cpp @@ -44,7 +44,7 @@ ExecPtr Exec::init() Exec* Exec::start() { - kernel::actor::simcall([this] { + kernel::actor::simcall_answered([this] { (*boost::static_pointer_cast(pimpl_)) .set_name(get_name()) .set_tracing_category(get_tracing_category()) @@ -75,7 +75,7 @@ ExecPtr Exec::set_bound(double bound) { xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot change the bound of an exec after its start"); - kernel::actor::simcall( + kernel::actor::simcall_answered( [this, bound] { boost::static_pointer_cast(pimpl_)->set_bound(bound); }); return this; } @@ -90,7 +90,7 @@ ExecPtr Exec::set_priority(double priority) { xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot change the priority of an exec after its start"); - kernel::actor::simcall([this, priority] { + kernel::actor::simcall_answered([this, priority] { boost::static_pointer_cast(pimpl_)->set_sharing_penalty(1. / priority); }); return this; @@ -98,7 +98,7 @@ ExecPtr Exec::set_priority(double priority) ExecPtr Exec::update_priority(double priority) { - kernel::actor::simcall([this, priority] { + kernel::actor::simcall_answered([this, priority] { boost::static_pointer_cast(pimpl_)->update_sharing_penalty(1. / priority); }); return this; @@ -108,7 +108,7 @@ ExecPtr Exec::set_flops_amount(double flops_amount) { xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot change the flop_amount of an exec after its start"); - kernel::actor::simcall([this, flops_amount] { + kernel::actor::simcall_answered([this, flops_amount] { boost::static_pointer_cast(pimpl_)->set_flops_amount(flops_amount); }); Activity::set_remaining(flops_amount); @@ -119,7 +119,7 @@ ExecPtr Exec::set_flops_amounts(const std::vector& flops_amounts) { xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot change the flops_amounts of an exec after its start"); - kernel::actor::simcall([this, flops_amounts] { + kernel::actor::simcall_answered([this, flops_amounts] { boost::static_pointer_cast(pimpl_)->set_flops_amounts(flops_amounts); }); parallel_ = true; @@ -130,7 +130,7 @@ ExecPtr Exec::set_bytes_amounts(const std::vector& bytes_amounts) { xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot change the bytes_amounts of an exec after its start"); - kernel::actor::simcall([this, bytes_amounts] { + kernel::actor::simcall_answered([this, bytes_amounts] { boost::static_pointer_cast(pimpl_)->set_bytes_amounts(bytes_amounts); }); parallel_ = true; @@ -160,7 +160,7 @@ ExecPtr Exec::set_host(Host* host) if (state_ == State::STARTED) boost::static_pointer_cast(pimpl_)->migrate(host); - kernel::actor::simcall( + kernel::actor::simcall_answered( [this, host] { boost::static_pointer_cast(pimpl_)->set_host(host); }); if (state_ == State::STARTING) @@ -175,7 +175,7 @@ ExecPtr Exec::set_hosts(const std::vector& hosts) xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot change the hosts of an exec once it's done (state: %s)", to_c_str(state_)); - kernel::actor::simcall( + kernel::actor::simcall_answered( [this, hosts] { boost::static_pointer_cast(pimpl_)->set_hosts(hosts); }); parallel_ = true; @@ -213,7 +213,7 @@ double Exec::get_remaining() const XBT_WARN("Calling get_remaining() on a parallel execution is not allowed. Call get_remaining_ratio() instead."); return get_remaining_ratio(); } else - return kernel::actor::simcall( + return kernel::actor::simcall_answered( [this]() { return boost::static_pointer_cast(pimpl_)->get_remaining(); }); } @@ -224,10 +224,10 @@ double Exec::get_remaining() const double Exec::get_remaining_ratio() const { if (is_parallel()) - return kernel::actor::simcall( + return kernel::actor::simcall_answered( [this]() { return boost::static_pointer_cast(pimpl_)->get_par_remaining_ratio(); }); else - return kernel::actor::simcall( + return kernel::actor::simcall_answered( [this]() { return boost::static_pointer_cast(pimpl_)->get_seq_remaining_ratio(); }); } diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index f90eba1eab..d84f23e6e8 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -65,7 +65,7 @@ Host::~Host() */ void Host::destroy() { - kernel::actor::simcall([this] { this->pimpl_->destroy(); }); + kernel::actor::simcall_answered([this] { this->pimpl_->destroy(); }); } Host* Host::by_name(const std::string& name) @@ -97,7 +97,7 @@ const char* Host::get_cname() const void Host::turn_on() { if (not is_on()) { - kernel::actor::simcall([this] { + kernel::actor::simcall_answered([this] { this->pimpl_cpu_->turn_on(); this->pimpl_->turn_on(); on_state_change(*this); @@ -110,7 +110,7 @@ void Host::turn_off() { if (is_on()) { const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self(); - kernel::actor::simcall([this, self] { + kernel::actor::simcall_answered([this, self] { for (VirtualMachine* const& vm : kernel::resource::VirtualMachineImpl::allVms_) if (vm->get_pm() == this) { vm->shutdown(); @@ -201,13 +201,13 @@ const char* Host::get_property(const std::string& key) const Host* Host::set_property(const std::string& key, const std::string& value) { - kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); + kernel::actor::simcall_answered([this, &key, &value] { this->pimpl_->set_property(key, value); }); return this; } Host* Host::set_properties(const std::unordered_map& properties) { - kernel::actor::simcall([this, &properties] { this->pimpl_->set_properties(properties); }); + kernel::actor::simcall_answered([this, &properties] { this->pimpl_->set_properties(properties); }); return this; } @@ -215,7 +215,7 @@ Host* Host::set_properties(const std::unordered_map& p * The profile must contain boolean values. */ Host* Host::set_state_profile(kernel::profile::Profile* p) { - kernel::actor::simcall([this, p] { pimpl_cpu_->set_state_profile(p); }); + kernel::actor::simcall_answered([this, p] { pimpl_cpu_->set_state_profile(p); }); return this; } /** Specify a profile modeling the external load according to an exhaustive list or a stochastic law. @@ -226,7 +226,7 @@ Host* Host::set_state_profile(kernel::profile::Profile* p) */ Host* Host::set_speed_profile(kernel::profile::Profile* p) { - kernel::actor::simcall([this, p] { pimpl_cpu_->set_speed_profile(p); }); + kernel::actor::simcall_answered([this, p] { pimpl_cpu_->set_speed_profile(p); }); return this; } @@ -251,7 +251,7 @@ double Host::get_available_speed() const Host* Host::set_sharing_policy(SharingPolicy policy, const s4u::NonLinearResourceCb& cb) { - kernel::actor::simcall([this, policy, &cb] { pimpl_cpu_->set_sharing_policy(policy, cb); }); + kernel::actor::simcall_answered([this, policy, &cb] { pimpl_cpu_->set_sharing_policy(policy, cb); }); return this; } @@ -267,13 +267,13 @@ int Host::get_core_count() const Host* Host::set_core_count(int core_count) { - kernel::actor::simcall([this, core_count] { this->pimpl_cpu_->set_core_count(core_count); }); + kernel::actor::simcall_answered([this, core_count] { this->pimpl_cpu_->set_core_count(core_count); }); return this; } Host* Host::set_pstate_speed(const std::vector& speed_per_state) { - kernel::actor::simcall([this, &speed_per_state] { pimpl_cpu_->set_pstate_speed(speed_per_state); }); + kernel::actor::simcall_answered([this, &speed_per_state] { pimpl_cpu_->set_pstate_speed(speed_per_state); }); return this; } @@ -301,7 +301,7 @@ Host* Host::set_pstate_speed(const std::vector& speed_per_state) /** @brief Set the pstate at which the host should run */ Host* Host::set_pstate(unsigned long pstate_index) { - kernel::actor::simcall([this, pstate_index] { this->pimpl_cpu_->set_pstate(pstate_index); }); + kernel::actor::simcall_answered([this, pstate_index] { this->pimpl_cpu_->set_pstate(pstate_index); }); return this; } @@ -313,14 +313,14 @@ unsigned long Host::get_pstate() const Host* Host::set_factor_cb(const std::function& cb) { - kernel::actor::simcall([this, &cb] { pimpl_cpu_->set_factor_cb(cb); }); + kernel::actor::simcall_answered([this, &cb] { pimpl_cpu_->set_factor_cb(cb); }); return this; } Host* Host::set_coordinates(const std::string& coords) { if (not coords.empty()) - kernel::actor::simcall([this, coords] { this->pimpl_netpoint_->set_coordinates(coords); }); + kernel::actor::simcall_answered([this, coords] { this->pimpl_netpoint_->set_coordinates(coords); }); return this; } std::vector Host::get_disks() const @@ -330,7 +330,7 @@ std::vector Host::get_disks() const Disk* Host::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth) { - return kernel::actor::simcall([this, &name, read_bandwidth, write_bandwidth] { + return kernel::actor::simcall_answered([this, &name, read_bandwidth, write_bandwidth] { auto* disk = pimpl_->create_disk(name, read_bandwidth, write_bandwidth); pimpl_->add_disk(disk); return disk; @@ -358,12 +358,12 @@ Disk* Host::create_disk(const std::string& name, const std::string& read_bandwid void Host::add_disk(const Disk* disk) { - kernel::actor::simcall([this, disk] { this->pimpl_->add_disk(disk); }); + kernel::actor::simcall_answered([this, disk] { this->pimpl_->add_disk(disk); }); } void Host::remove_disk(const std::string& disk_name) { - kernel::actor::simcall([this, disk_name] { this->pimpl_->remove_disk(disk_name); }); + kernel::actor::simcall_answered([this, disk_name] { this->pimpl_->remove_disk(disk_name); }); } VirtualMachine* Host::create_vm(const std::string& name, int core_amount) @@ -398,7 +398,7 @@ void Host::execute(double flops, double priority) const Host* Host::seal() { - kernel::actor::simcall([this]() { this->pimpl_->seal(); }); + kernel::actor::simcall_answered([this]() { this->pimpl_->seal(); }); simgrid::s4u::Host::on_creation(*this); // notify the signal return this; } diff --git a/src/s4u/s4u_Io.cpp b/src/s4u/s4u_Io.cpp index 77856e763c..cd1cdbe352 100644 --- a/src/s4u/s4u_Io.cpp +++ b/src/s4u/s4u_Io.cpp @@ -28,7 +28,7 @@ IoPtr Io::init() Io* Io::start() { - kernel::actor::simcall( + kernel::actor::simcall_answered( [this] { (*boost::static_pointer_cast(pimpl_)).set_name(get_name()).start(); }); if (suspended_) @@ -51,7 +51,7 @@ IoPtr Io::set_disk(const_sg_disk_t disk) { xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot set disk once the Io is started"); - kernel::actor::simcall( + kernel::actor::simcall_answered( [this, disk] { boost::static_pointer_cast(pimpl_)->set_disk(disk->get_impl()); }); // Setting the disk may allow to start the activity, let's try @@ -65,7 +65,7 @@ IoPtr Io::set_priority(double priority) { xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot change the priority of an io after its start"); - kernel::actor::simcall([this, priority] { + kernel::actor::simcall_answered([this, priority] { boost::static_pointer_cast(pimpl_)->set_sharing_penalty(1. / priority); }); return this; @@ -74,7 +74,7 @@ IoPtr Io::set_priority(double priority) IoPtr Io::set_size(sg_size_t size) { xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot set size once the Io is started"); - kernel::actor::simcall( + kernel::actor::simcall_answered( [this, size] { boost::static_pointer_cast(pimpl_)->set_size(size); }); Activity::set_remaining(size); return this; @@ -83,14 +83,14 @@ IoPtr Io::set_size(sg_size_t size) IoPtr Io::set_op_type(OpType type) { xbt_assert(state_ == State::INITED || state_ == State::STARTING, "Cannot set size once the Io is started"); - kernel::actor::simcall( + kernel::actor::simcall_answered( [this, type] { boost::static_pointer_cast(pimpl_)->set_type(type); }); return this; } IoPtr Io::update_priority(double priority) { - kernel::actor::simcall([this, priority] { + kernel::actor::simcall_answered([this, priority] { boost::static_pointer_cast(pimpl_)->update_sharing_penalty(1. / priority); }); return this; @@ -99,7 +99,7 @@ IoPtr Io::update_priority(double priority) /** @brief Returns the amount of flops that remain to be done */ double Io::get_remaining() const { - return kernel::actor::simcall( + return kernel::actor::simcall_answered( [this]() { return boost::static_pointer_cast(pimpl_)->get_remaining(); }); } diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index ff36c714b7..c1d4ffb204 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -72,7 +72,7 @@ double Link::get_latency() const Link* Link::set_latency(double value) { - kernel::actor::simcall([this, value] { pimpl_->set_latency(value); }); + kernel::actor::simcall_answered([this, value] { pimpl_->set_latency(value); }); return this; } @@ -95,7 +95,7 @@ double Link::get_bandwidth() const Link* Link::set_bandwidth(double value) { - kernel::actor::simcall([this, value] { pimpl_->set_bandwidth(value); }); + kernel::actor::simcall_answered([this, value] { pimpl_->set_bandwidth(value); }); return this; } @@ -105,7 +105,7 @@ Link* Link::set_sharing_policy(Link::SharingPolicy policy, const NonLinearResour throw std::invalid_argument(std::string("Impossible to set wifi or split-duplex for the link: ") + get_name() + std::string(". Use appropriate create function in NetZone.")); - kernel::actor::simcall([this, policy, &cb] { pimpl_->set_sharing_policy(policy, cb); }); + kernel::actor::simcall_answered([this, policy, &cb] { pimpl_->set_sharing_policy(policy, cb); }); return this; } Link::SharingPolicy Link::get_sharing_policy() const @@ -122,7 +122,7 @@ void Link::set_host_wifi_rate(const s4u::Host* host, int level) const Link* Link::set_concurrency_limit(int limit) { - kernel::actor::simcall([this, limit] { pimpl_->set_concurrency_limit(limit); }); + kernel::actor::simcall_answered([this, limit] { pimpl_->set_concurrency_limit(limit); }); return this; } @@ -133,15 +133,15 @@ double Link::get_usage() const void Link::turn_on() { - kernel::actor::simcall([this]() { this->pimpl_->turn_on(); }); + kernel::actor::simcall_answered([this]() { this->pimpl_->turn_on(); }); } void Link::turn_off() { - kernel::actor::simcall([this]() { this->pimpl_->turn_off(); }); + kernel::actor::simcall_answered([this]() { this->pimpl_->turn_off(); }); } Link* Link::seal() { - kernel::actor::simcall([this]() { this->pimpl_->seal(); }); + kernel::actor::simcall_answered([this]() { this->pimpl_->seal(); }); s4u::Link::on_creation(*this); // notify the signal return this; } @@ -154,21 +154,21 @@ bool Link::is_on() const Link* Link::set_state_profile(kernel::profile::Profile* profile) { xbt_assert(not pimpl_->is_sealed(), "Cannot set a state profile once the Link is sealed"); - kernel::actor::simcall([this, profile]() { this->pimpl_->set_state_profile(profile); }); + kernel::actor::simcall_answered([this, profile]() { this->pimpl_->set_state_profile(profile); }); return this; } Link* Link::set_bandwidth_profile(kernel::profile::Profile* profile) { xbt_assert(not pimpl_->is_sealed(), "Cannot set a bandwidth profile once the Link is sealed"); - kernel::actor::simcall([this, profile]() { this->pimpl_->set_bandwidth_profile(profile); }); + kernel::actor::simcall_answered([this, profile]() { this->pimpl_->set_bandwidth_profile(profile); }); return this; } Link* Link::set_latency_profile(kernel::profile::Profile* profile) { xbt_assert(not pimpl_->is_sealed(), "Cannot set a latency profile once the Link is sealed"); - kernel::actor::simcall([this, profile]() { this->pimpl_->set_latency_profile(profile); }); + kernel::actor::simcall_answered([this, profile]() { this->pimpl_->set_latency_profile(profile); }); return this; } @@ -178,7 +178,7 @@ const char* Link::get_property(const std::string& key) const } Link* Link::set_property(const std::string& key, const std::string& value) { - kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); }); + kernel::actor::simcall_answered([this, &key, &value] { this->pimpl_->set_property(key, value); }); return this; } @@ -189,7 +189,7 @@ const std::unordered_map* Link::get_properties() const Link* Link::set_properties(const std::unordered_map& properties) { - kernel::actor::simcall([this, &properties] { this->pimpl_->set_properties(properties); }); + kernel::actor::simcall_answered([this, &properties] { this->pimpl_->set_properties(properties); }); return this; } diff --git a/src/s4u/s4u_Mailbox.cpp b/src/s4u/s4u_Mailbox.cpp index eda04e7c2a..b3a33a681d 100644 --- a/src/s4u/s4u_Mailbox.cpp +++ b/src/s4u/s4u_Mailbox.cpp @@ -73,7 +73,7 @@ kernel::activity::CommImplPtr Mailbox::front() const void Mailbox::set_receiver(ActorPtr actor) { - kernel::actor::simcall([this, actor]() { this->pimpl_->set_receiver(actor); }); + kernel::actor::simcall_answered([this, actor]() { this->pimpl_->set_receiver(actor); }); } /** @brief get the receiver (process associated to the mailbox) */ @@ -132,7 +132,8 @@ CommPtr Mailbox::get_init() kernel::activity::ActivityImplPtr Mailbox::iprobe(int type, bool (*match_fun)(void*, void*, kernel::activity::CommImpl*), void* data) { - return kernel::actor::simcall([this, type, match_fun, data] { return pimpl_->iprobe(type, match_fun, data); }); + return kernel::actor::simcall_answered( + [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 3fca4c43f1..27fda2fea2 100644 --- a/src/s4u/s4u_Mutex.cpp +++ b/src/s4u/s4u_Mutex.cpp @@ -20,7 +20,8 @@ void Mutex::lock() if (MC_is_active() || MC_record_replay_is_active()) { // Split in 2 simcalls for transition persistency kernel::actor::MutexObserver lock_observer{issuer, mc::Transition::Type::MUTEX_LOCK, pimpl_}; - auto acquisition = kernel::actor::simcall([issuer, this] { return pimpl_->lock_async(issuer); }, &lock_observer); + auto acquisition = + kernel::actor::simcall_answered([issuer, this] { return pimpl_->lock_async(issuer); }, &lock_observer); kernel::actor::MutexObserver wait_observer{issuer, mc::Transition::Type::MUTEX_WAIT, pimpl_}; kernel::actor::simcall_blocking([issuer, acquisition] { return acquisition->wait_for(issuer, -1); }, @@ -39,7 +40,7 @@ void Mutex::unlock() { kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); kernel::actor::MutexObserver observer{issuer, mc::Transition::Type::MUTEX_UNLOCK, pimpl_}; - kernel::actor::simcall([this, issuer] { this->pimpl_->unlock(issuer); }, &observer); + kernel::actor::simcall_answered([this, issuer] { this->pimpl_->unlock(issuer); }, &observer); } /** @brief Acquire the mutex if it's free, and return false (without blocking) if not */ @@ -47,8 +48,8 @@ bool Mutex::try_lock() { kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); kernel::actor::MutexObserver observer{issuer, mc::Transition::Type::MUTEX_TRYLOCK, pimpl_}; - return kernel::actor::simcall([&observer] { return observer.get_mutex()->try_lock(observer.get_issuer()); }, - &observer); + return kernel::actor::simcall_answered([&observer] { return observer.get_mutex()->try_lock(observer.get_issuer()); }, + &observer); } /** @brief Create a new mutex diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index b17d6a38d2..06950ef004 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -38,7 +38,7 @@ const char* NetZone::get_property(const std::string& key) const void NetZone::set_property(const std::string& key, const std::string& value) { - kernel::actor::simcall([this, &key, &value] { pimpl_->set_property(key, value); }); + kernel::actor::simcall_answered([this, &key, &value] { pimpl_->set_property(key, value); }); } /** @brief Returns the list of direct children (no grand-children) */ @@ -73,7 +73,7 @@ NetZone* NetZone::get_parent() const NetZone* NetZone::set_parent(const NetZone* parent) { - kernel::actor::simcall([this, parent] { pimpl_->set_parent(parent->get_impl()); }); + kernel::actor::simcall_answered([this, parent] { pimpl_->set_parent(parent->get_impl()); }); return this; } @@ -149,7 +149,7 @@ void NetZone::extract_xbt_graph(const s_xbt_graph_t* graph, std::mapseal(); }); + kernel::actor::simcall_answered([this] { pimpl_->seal(); }); return this; } @@ -160,7 +160,7 @@ s4u::Host* NetZone::create_host(const std::string& name, double speed) s4u::Host* NetZone::create_host(const std::string& name, const std::vector& speed_per_pstate) { - return kernel::actor::simcall( + return kernel::actor::simcall_answered( [this, &name, &speed_per_pstate] { return pimpl_->create_host(name, speed_per_pstate); }); } @@ -181,7 +181,7 @@ s4u::Link* NetZone::create_link(const std::string& name, double bandwidth) s4u::Link* NetZone::create_link(const std::string& name, const std::vector& bandwidths) { - return kernel::actor::simcall([this, &name, &bandwidths] { return pimpl_->create_link(name, bandwidths); }); + return kernel::actor::simcall_answered([this, &name, &bandwidths] { return pimpl_->create_link(name, bandwidths); }); } s4u::Link* NetZone::create_link(const std::string& name, const std::string& bandwidth) @@ -203,7 +203,7 @@ s4u::SplitDuplexLink* NetZone::create_split_duplex_link(const std::string& name, s4u::SplitDuplexLink* NetZone::create_split_duplex_link(const std::string& name, double bandwidth) { - return kernel::actor::simcall( + return kernel::actor::simcall_answered( [this, &name, &bandwidth] { return pimpl_->create_split_duplex_link(name, std::vector{bandwidth}); }); } @@ -225,7 +225,7 @@ s4u::Link* NetZone::create_link(const std::string& name, const std::vectorcreate_router(name); }); + return kernel::actor::simcall_answered([this, &name] { return pimpl_->create_router(name); }); } kernel::routing::NetPoint* NetZone::get_netpoint() diff --git a/src/s4u/s4u_Semaphore.cpp b/src/s4u/s4u_Semaphore.cpp index d0a1b79598..6f8565a0c0 100644 --- a/src/s4u/s4u_Semaphore.cpp +++ b/src/s4u/s4u_Semaphore.cpp @@ -35,17 +35,17 @@ bool Semaphore::acquire_timeout(double timeout) void Semaphore::release() { - kernel::actor::simcall([this] { pimpl_->release(); }); + kernel::actor::simcall_answered([this] { pimpl_->release(); }); } int Semaphore::get_capacity() const { - return kernel::actor::simcall([this] { return pimpl_->get_capacity(); }); + return kernel::actor::simcall_answered([this] { return pimpl_->get_capacity(); }); } bool Semaphore::would_block() const { - return kernel::actor::simcall([this] { return pimpl_->would_block(); }); + return kernel::actor::simcall_answered([this] { return pimpl_->would_block(); }); } /* refcounting of the intrusive_ptr is delegated to the implementation object */ diff --git a/src/s4u/s4u_VirtualMachine.cpp b/src/s4u/s4u_VirtualMachine.cpp index 1eea2eec32..b53de10f83 100644 --- a/src/s4u/s4u_VirtualMachine.cpp +++ b/src/s4u/s4u_VirtualMachine.cpp @@ -66,7 +66,7 @@ void VirtualMachine::start() VmHostExt::ensureVmExtInstalled(); - kernel::actor::simcall([this]() { + kernel::actor::simcall_answered([this]() { Host* pm = this->pimpl_vm_->get_physical_host(); if (pm->extension() == nullptr) pm->extension_set(new VmHostExt()); @@ -97,7 +97,7 @@ void VirtualMachine::suspend() { on_suspend(*this); const kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); - kernel::actor::simcall([this, issuer]() { pimpl_vm_->suspend(issuer); }); + kernel::actor::simcall_answered([this, issuer]() { pimpl_vm_->suspend(issuer); }); } void VirtualMachine::resume() @@ -109,7 +109,7 @@ void VirtualMachine::resume() void VirtualMachine::shutdown() { kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); - kernel::actor::simcall([this, issuer]() { pimpl_vm_->shutdown(issuer); }); + kernel::actor::simcall_answered([this, issuer]() { pimpl_vm_->shutdown(issuer); }); on_shutdown(*this); } @@ -122,7 +122,7 @@ void VirtualMachine::destroy() XBT_DEBUG("destroy %s", get_cname()); on_destruction(*this); /* Then, destroy the VM object */ - kernel::actor::simcall([this]() { + kernel::actor::simcall_answered([this]() { get_vm_impl()->vm_destroy(); get_impl()->destroy(); @@ -150,13 +150,13 @@ simgrid::s4u::Host* VirtualMachine::get_pm() const VirtualMachine* VirtualMachine::set_pm(simgrid::s4u::Host* pm) { - kernel::actor::simcall([this, pm]() { pimpl_vm_->set_physical_host(pm); }); + kernel::actor::simcall_answered([this, pm]() { pimpl_vm_->set_physical_host(pm); }); return this; } VirtualMachine::State VirtualMachine::get_state() const { - return kernel::actor::simcall([this]() { return pimpl_vm_->get_state(); }); + return kernel::actor::simcall_answered([this]() { return pimpl_vm_->get_state(); }); } size_t VirtualMachine::get_ramsize() const @@ -197,7 +197,7 @@ VirtualMachine* VirtualMachine::set_ramsize(size_t ramsize) */ VirtualMachine* VirtualMachine::set_bound(double bound) { - kernel::actor::simcall([this, bound]() { pimpl_vm_->set_bound(bound); }); + kernel::actor::simcall_answered([this, bound]() { pimpl_vm_->set_bound(bound); }); return this; } diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 2cbde145c9..128d2d96b3 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -50,7 +50,7 @@ void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, simgrid::kernel::actor::CommIsendSimcall send_observer{ sender, mbox, task_size, rate, static_cast(src_buff), src_buff_size, match_fun, nullptr, copy_data_fun, data, false}; - comm = simgrid::kernel::actor::simcall( + comm = simgrid::kernel::actor::simcall_answered( [&send_observer] { return simgrid::kernel::activity::CommImpl::isend(&send_observer); }, &send_observer); simgrid::kernel::actor::ActivityWaitSimcall wait_observer{sender, comm.get(), timeout}; @@ -92,7 +92,8 @@ simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, dou simgrid::kernel::actor::CommIsendSimcall observer(sender, mbox, task_size, rate, static_cast(src_buff), src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached); - return simgrid::kernel::actor::simcall([&observer] { return simgrid::kernel::activity::CommImpl::isend(&observer); }); + return simgrid::kernel::actor::simcall_answered( + [&observer] { return simgrid::kernel::activity::CommImpl::isend(&observer); }); } /** @@ -112,7 +113,7 @@ void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, simgrid::kernel::actor::CommIrecvSimcall observer{ receiver, mbox, static_cast(dst_buff), dst_buff_size, match_fun, copy_data_fun, data, rate}; - comm = simgrid::kernel::actor::simcall( + comm = simgrid::kernel::actor::simcall_answered( [&observer] { return simgrid::kernel::activity::CommImpl::irecv(&observer); }, &observer); simgrid::kernel::actor::ActivityWaitSimcall wait_observer{receiver, comm.get(), timeout}; @@ -146,7 +147,8 @@ simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, siz simgrid::kernel::actor::CommIrecvSimcall observer(receiver, mbox, static_cast(dst_buff), dst_buff_size, match_fun, copy_data_fun, data, rate); - return simgrid::kernel::actor::simcall([&observer] { return simgrid::kernel::activity::CommImpl::irecv(&observer); }); + return simgrid::kernel::actor::simcall_answered( + [&observer] { return simgrid::kernel::activity::CommImpl::irecv(&observer); }); } /** @@ -235,7 +237,7 @@ static void simcall(simgrid::simix::Simcall call, std::function const& c } } -void simcall_run_kernel(std::function const& code, simgrid::kernel::actor::SimcallObserver* observer) +void simcall_run_answered(std::function const& code, simgrid::kernel::actor::SimcallObserver* observer) { simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = observer; // The function `code` is called in kernel mode (either because we are already in maestor or after a context switch) diff --git a/src/smpi/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index f2638defec..842e16a5dc 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -135,10 +135,10 @@ int PMPI_Abort(MPI_Comm comm, int /*errorcode*/) for (int i = 0; i < comm->size(); i++){ auto actor = simgrid::kernel::actor::ActorImpl::by_pid(comm->group()->actor(i)); if (actor != nullptr && actor != myself) - simgrid::kernel::actor::simcall([actor] { actor->exit(); }); + simgrid::kernel::actor::simcall_answered([actor] { actor->exit(); }); } // now ourself - simgrid::kernel::actor::simcall([myself] { myself->exit(); }); + simgrid::kernel::actor::simcall_answered([myself] { myself->exit(); }); return MPI_SUCCESS; } diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index e8ab078064..a4785c81e0 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -521,7 +521,8 @@ void Request::start() -1.0}; observer.set_tag(tag_); - action_ = kernel::actor::simcall([&observer] { return kernel::activity::CommImpl::irecv(&observer); }, &observer); + action_ = kernel::actor::simcall_answered([&observer] { return kernel::activity::CommImpl::irecv(&observer); }, + &observer); XBT_DEBUG("recv simcall posted"); @@ -626,7 +627,8 @@ void Request::start() // detach if msg size < eager/rdv switch limit detached_}; observer.set_tag(tag_); - action_ = kernel::actor::simcall([&observer] { return kernel::activity::CommImpl::isend(&observer); }, &observer); + action_ = kernel::actor::simcall_answered([&observer] { return kernel::activity::CommImpl::isend(&observer); }, + &observer); XBT_DEBUG("send simcall posted"); /* FIXME: detached sends are not traceable (action_ == nullptr) */ @@ -684,8 +686,8 @@ int Request::test(MPI_Request * request, MPI_Status * status, int* flag) { try{ kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); kernel::actor::ActivityTestSimcall observer{issuer, (*request)->action_.get()}; - *flag = kernel::actor::simcall([&observer] { return observer.get_activity()->test(observer.get_issuer()); }, - &observer); + *flag = kernel::actor::simcall_answered( + [&observer] { return observer.get_activity()->test(observer.get_issuer()); }, &observer); } catch (const Exception&) { *flag = 0; return ret; @@ -774,7 +776,7 @@ int Request::testany(int count, MPI_Request requests[], int *index, int* flag, M try{ kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); kernel::actor::ActivityTestanySimcall observer{issuer, comms}; - i = kernel::actor::simcall( + i = kernel::actor::simcall_answered( [&observer] { return kernel::activity::ActivityImpl::test_any(observer.get_issuer(), observer.get_activities()); }, diff --git a/teshsuite/kernel/simcall-generic/blocking_simcall.hpp b/teshsuite/kernel/simcall-generic/blocking_simcall.hpp index 4b13a2f1fc..c67088425f 100644 --- a/teshsuite/kernel/simcall-generic/blocking_simcall.hpp +++ b/teshsuite/kernel/simcall-generic/blocking_simcall.hpp @@ -149,7 +149,7 @@ template auto kernel_async(F code) -> Future using T = decltype(code().get()); // Execute the code in the kernel and get the kernel future: - kernel::Future future = kernel::actor::simcall(std::move(code)); + kernel::Future future = kernel::actor::simcall_answered(std::move(code)); // Wrap the kernel future in an actor future: return Future(std::move(future)); diff --git a/teshsuite/kernel/simcall-generic/simcall-generic.cpp b/teshsuite/kernel/simcall-generic/simcall-generic.cpp index b8ea7c857c..3f989018b5 100644 --- a/teshsuite/kernel/simcall-generic/simcall-generic.cpp +++ b/teshsuite/kernel/simcall-generic/simcall-generic.cpp @@ -38,7 +38,7 @@ static void master() { // Test the simple immediate execution: XBT_INFO("Start"); - simgrid::kernel::actor::simcall([] { XBT_INFO("kernel"); }); + simgrid::kernel::actor::simcall_answered([] { XBT_INFO("kernel"); }); XBT_INFO("kernel, returned"); // Synchronize on a successful Future: -- 2.20.1