if(Boost_FOUND AND Boost_CONTEXT_FOUND)
# We should use feature detection for this instead:
if (Boost_VERSION LESS 105600)
- message("Found suitable Boost.Context")
+ message("Found Boost.Context API v1")
set(HAVE_BOOST_CONTEXT 1)
else()
- message("Found unsuitable version of Boost.Context (${Boost_VERSION}, up to 1.55 is currenly implemented)")
- set(HAVE_BOOST_CONTEXT 0)
+ message("Found Boost.Context API v2")
+ set(HAVE_BOOST_CONTEXT 2)
endif()
else()
set(HAVE_BOOST_CONTEXT 0)
typedef struct s_smx_ctx_boost {
s_smx_ctx_base_t super; /* Fields of super implementation */
+#if HAVE_BOOST_CONTEXT == 1
boost::context::fcontext_t* fc;
+#else
+ boost::context::fcontext_t fc;
+#endif
void* stack;
} s_smx_ctx_boost_t, *smx_ctx_boost_t;
smx_ctx_boost_wrapper);
} else {
context->stack = nullptr;
+#if HAVE_BOOST_CONTEXT == 1
context->fc = new boost::context::fcontext_t();
+#endif
if (boost_maestro_context == nullptr)
boost_maestro_context = context;
}
smx_ctx_boost_t context = (smx_ctx_boost_t) c;
if (!context)
return;
+#if HAVE_BOOST_CONTEXT == 1
if (!context->stack)
delete context->fc;
+#endif
if ((smx_ctx_boost_t) c == boost_maestro_context)
boost_maestro_context = nullptr;
SIMIX_context_stack_delete(context->stack);
next_context = (smx_ctx_boost_t) boost_maestro_context;
}
SIMIX_context_set_current((smx_context_t) next_context);
+#if HAVE_BOOST_CONTEXT == 1
boost::context::jump_fcontext(
((smx_ctx_boost_t)context)->fc, next_context->fc, (intptr_t)next_context);
+#else
+ boost::context::jump_fcontext(
+ &((smx_ctx_boost_t)context)->fc, next_context->fc, (intptr_t)next_context);
+#endif
}
static void smx_ctx_boost_resume_serial(smx_process_t first_process)
{
smx_ctx_boost_t context = (smx_ctx_boost_t) first_process->context;
SIMIX_context_set_current((smx_context_t) context);
+#if HAVE_BOOST_CONTEXT == 1
boost::context::jump_fcontext(boost_maestro_context->fc, context->fc,
(intptr_t)context);
+#else
+ boost::context::jump_fcontext(&boost_maestro_context->fc, context->fc,
+ (intptr_t)context);
+#endif
}
static void smx_ctx_boost_runall_serial(void)
}
SIMIX_context_set_current((smx_context_t) next_context);
+#if HAVE_BOOST_CONTEXT == 1
boost::context::jump_fcontext(
((smx_ctx_boost_t)context)->fc, next_context->fc, (intptr_t)next_context);
+#else
+ boost::context::jump_fcontext(
+ &((smx_ctx_boost_t)context)->fc, next_context->fc, (intptr_t)next_context);
+#endif
}
static void smx_ctx_boost_resume_parallel(smx_process_t process)
smx_ctx_boost_t context = (smx_ctx_boost_t) process->context;
SIMIX_context_set_current((smx_context_t) context);
+#if HAVE_BOOST_CONTEXT == 1
boost::context::jump_fcontext(worker_context->fc, context->fc,
(intptr_t)context);
+#else
+ boost::context::jump_fcontext(&worker_context->fc, context->fc,
+ (intptr_t)context);
+#endif
}
static void smx_ctx_boost_runall_parallel(void)