-/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2006-2020. 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. */
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/VirtualMachine.hpp"
#include "src/include/mc/mc.h"
+#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/activity/ExecImpl.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/surf/HostImpl.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_actor, s4u, "S4U actors");
namespace simgrid {
+
+template class xbt::Extendable<s4u::Actor>;
+
namespace s4u {
xbt::signal<void(Actor&)> s4u::Actor::on_creation;
ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::string& function,
std::vector<std::string> args)
{
- const simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
+ const simgrid::kernel::actor::ActorCodeFactory& factory =
+ simgrid::kernel::EngineImpl::get_instance()->get_function(function);
return create(name, host, factory(std::move(args)));
}
// The joined process is already finished, just wake up the issuer right away
issuer->simcall_answer();
} else {
- smx_activity_t sync = issuer->join(target, timeout);
+ kernel::activity::ActivityImplPtr sync = issuer->join(target, timeout);
sync->register_simcall(&issuer->simcall);
}
});
issuer->simcall_answer();
return;
}
- smx_activity_t sync = issuer->sleep(duration);
+ kernel::activity::ActivityImplPtr sync = issuer->sleep(duration);
sync->register_simcall(&issuer->simcall);
});
kernel::actor::simcall_blocking<void>([self] { self->suspend(); });
}
-void resume()
-{
- kernel::actor::ActorImpl* self = simgrid::kernel::actor::ActorImpl::self();
- kernel::actor::simcall([self] { self->resume(); });
- Actor::on_resume(*self->ciface());
-}
-
void exit()
{
kernel::actor::ActorImpl* self = simgrid::kernel::actor::ActorImpl::self();
return simgrid::s4u::Actor::init(name, host).get();
}
-void sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, char** argv)
+void sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, const char* const* argv)
{
- simgrid::simix::ActorCode function;
+ simgrid::kernel::actor::ActorCode function;
if (code)
- function = simgrid::xbt::wrap_main(code, argc, static_cast<const char* const*>(argv));
+ function = simgrid::xbt::wrap_main(code, argc, argv);
actor->start(std::move(function));
}