-
-bool BoostContext::parallel_ = false;
-xbt_parmap_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
- xbt_die("No thread support for parallel context execution");
-#else
- int nthreads = SIMIX_context_get_nthreads();
- BoostContext::parmap_ = xbt_parmap_new(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_);
-#endif
- }
-}
-
-BoostContextFactory::~BoostContextFactory()
-{
-#if HAVE_THREAD_CONTEXTS
- if (BoostContext::parmap_) {
- xbt_parmap_destroy(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)
-{
- BoostContext* context = nullptr;
- if (BoostContext::parallel_)
-#if HAVE_THREAD_CONTEXTS
- context = this->new_context<BoostParallelContext>(std::move(code), cleanup_func, process);
-#else
- xbt_die("No support for parallel execution");
-#endif
- else
- context = this->new_context<BoostSerialContext>(std::move(code), cleanup_func, process);
- return context;
-}
-
-void BoostContextFactory::run_all()