Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
if wait_any_for timeouts, unref remaining pending comms
[simgrid.git] / src / s4u / s4u_Actor.cpp
index 0ca43d2..ff5a08d 100644 (file)
@@ -56,6 +56,15 @@ ActorPtr Actor::init(const std::string& name, s4u::Host* host)
   return actor->iface();
 }
 
+/** Set a non-default stack size for this context (in Kb)
+ *
+ * This must be done before starting the actor, and it won't work with the thread factory. */
+ActorPtr Actor::set_stacksize(unsigned stacksize)
+{
+  pimpl_->set_stacksize(stacksize * 1024);
+  return this;
+}
+
 ActorPtr Actor::start(const std::function<void()>& code)
 {
   simgrid::kernel::actor::simcall([this, &code] { pimpl_->start(code); });
@@ -482,6 +491,11 @@ sg_actor_t sg_actor_create(const char* name, sg_host_t host, xbt_main_func_t cod
   return simgrid::s4u::Actor::init(name, host)->start(std::move(function)).get();
 }
 
+void sg_actor_set_stacksize(sg_actor_t actor, unsigned size)
+{
+  actor->set_stacksize(size);
+}
+
 void sg_actor_exit()
 {
   simgrid::s4u::this_actor::exit();