-
-bool BoostContext::parallel_ = false;
-simgrid::xbt::Parmap<smx_actor_t>* BoostContext::parmap_ = nullptr;
-uintptr_t BoostContext::threads_working_ = 0;
-xbt_os_thread_key_t BoostContext::worker_id_key_;
-unsigned long BoostContext::process_index_ = 0;
-BoostContext* BoostContext::maestro_context_ = nullptr;
-std::vector<BoostContext*> BoostContext::workers_context_;
-
-BoostContextFactory::BoostContextFactory()
- : ContextFactory("BoostContextFactory")
-{
- BoostContext::parallel_ = SIMIX_context_is_parallel();
- if (BoostContext::parallel_) {
-#if HAVE_THREAD_CONTEXTS
- int nthreads = SIMIX_context_get_nthreads();
- BoostContext::parmap_ = new simgrid::xbt::Parmap<smx_actor_t>(nthreads, SIMIX_context_get_parallel_mode());
- BoostContext::workers_context_.clear();
- BoostContext::workers_context_.resize(nthreads, nullptr);
- BoostContext::maestro_context_ = nullptr;
- xbt_os_thread_key_create(&BoostContext::worker_id_key_);
-#else
- xbt_die("No thread support for parallel context execution");
-#endif
- }
-}
-
-BoostContextFactory::~BoostContextFactory()
-{
-#if HAVE_THREAD_CONTEXTS
- if (BoostContext::parmap_) {
- delete BoostContext::parmap_;
- BoostContext::parmap_ = nullptr;
- }
- BoostContext::workers_context_.clear();
-#endif
-}
-
-smx_context_t BoostContextFactory::create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func,
- smx_actor_t process)