- return this->new_context<ThreadContext>(
- std::function<void()>(), cleanup_func, process, false);
-}
-
-ThreadContext* ThreadContextFactory::create_maestro(std::function<void()> code, smx_actor_t process)
-{
- return this->new_context<ThreadContext>(std::move(code), nullptr, process, true);
-}
-
-ThreadContext::ThreadContext(std::function<void()> code,
- void_pfn_smxprocess_t cleanup, smx_actor_t process, bool maestro)
- : AttachContext(std::move(code), cleanup, process)
-{
- // We do not need the semaphores when maestro is in main,
- // but creating them anyway simplifies things when maestro is externalized
- this->begin_ = xbt_os_sem_init(0);
- this->end_ = xbt_os_sem_init(0);
-
- /* If the user provided a function for the process then use it */