// BoostContextFactory
BoostContextFactory::BoostContextFactory()
- : ContextFactory("BoostContextFactory")
+ : ContextFactory("BoostContextFactory"), parallel_(SIMIX_context_is_parallel())
{
- BoostContext::parallel_ = SIMIX_context_is_parallel();
- if (BoostContext::parallel_) {
+ if (parallel_) {
#if HAVE_THREAD_CONTEXTS
BoostContext::parmap_ = nullptr;
BoostContext::workers_context_.clear();
smx_actor_t process)
{
#if HAVE_THREAD_CONTEXTS
- if (BoostContext::parallel_)
+ if (parallel_)
return this->new_context<ParallelBoostContext>(std::move(code), cleanup_func, process);
#endif
void BoostContextFactory::run_all()
{
#if HAVE_THREAD_CONTEXTS
- if (BoostContext::parallel_) {
+ if (parallel_) {
BoostContext::threads_working_ = 0;
if (not BoostContext::parmap_)
BoostContext::parmap_ =
// BoostContext
-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_;
/** @brief Userspace context switching implementation based on Boost.Context */
class BoostContext : public Context {
protected: // static
- static bool parallel_;
static simgrid::xbt::Parmap<smx_actor_t>* parmap_;
static std::vector<BoostContext*> workers_context_;
static uintptr_t threads_working_;
~BoostContextFactory() override;
Context* create_context(std::function<void()> code, void_pfn_smxprocess_t, smx_actor_t process) override;
void run_all() override;
+
+private:
+ bool parallel_;
};
}}} // namespace