From 3f2f18b52285fde45c284ccb83610d4937c16c59 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Tue, 12 Mar 2019 13:12:10 +0100 Subject: [PATCH] don't use old fashioned simcall when you don't have to --- src/s4u/s4u_Actor.cpp | 7 ++++--- src/s4u/s4u_ConditionVariable.cpp | 3 ++- src/s4u/s4u_Mutex.cpp | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 934e52b1b2..fa4677e9f7 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -42,8 +42,7 @@ ActorPtr Actor::self() ActorPtr Actor::init(const std::string& name, s4u::Host* host) { smx_actor_t self = SIMIX_process_self(); - simgrid::kernel::actor::ActorImpl* actor = - simgrid::simix::simcall([self, &name, host] { return self->init(name, host).get(); }); + kernel::actor::ActorImpl* actor = simix::simcall([self, &name, host] { return self->init(name, host).get(); }); return actor->ciface(); } @@ -55,7 +54,9 @@ ActorPtr Actor::start(const std::function& code) ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::function& code) { - simgrid::kernel::actor::ActorImpl* actor = simcall_process_create(name, code, nullptr, host, nullptr); + smx_actor_t self = SIMIX_process_self(); + kernel::actor::ActorImpl* actor = + simix::simcall([self, &name, host, &code] { return self->init(name, host)->start(code); }); return actor->iface(); } diff --git a/src/s4u/s4u_ConditionVariable.cpp b/src/s4u/s4u_ConditionVariable.cpp index 9908b0c991..e9f2c458ec 100644 --- a/src/s4u/s4u_ConditionVariable.cpp +++ b/src/s4u/s4u_ConditionVariable.cpp @@ -16,7 +16,8 @@ namespace s4u { ConditionVariablePtr ConditionVariable::create() { - smx_cond_t cond = simcall_cond_init(); + kernel::activity::ConditionVariableImpl* cond = + simix::simcall([] { return new kernel::activity::ConditionVariableImpl(); }); return ConditionVariablePtr(&cond->cond_, false); } diff --git a/src/s4u/s4u_Mutex.cpp b/src/s4u/s4u_Mutex.cpp index 5e0b6a7943..2f90b265d9 100644 --- a/src/s4u/s4u_Mutex.cpp +++ b/src/s4u/s4u_Mutex.cpp @@ -42,7 +42,7 @@ bool Mutex::try_lock() */ MutexPtr Mutex::create() { - smx_mutex_t mutex = simcall_mutex_init(); + kernel::activity::MutexImpl* mutex = simix::simcall([] { return new kernel::activity::MutexImpl(); }); return MutexPtr(&mutex->mutex(), false); } -- 2.20.1