-raw_stack_t raw_makecontext(void* malloced_stack, int stack_size,
- rawctx_entry_point_t entry_point, void* arg) {
- THROW_UNIMPLEMENTED;
-}
-
-void raw_swapcontext(raw_stack_t* old, raw_stack_t new_context) {
- THROW_UNIMPLEMENTED;
-}
-
-#endif
-
-// ***** Method definitions
-
-namespace simgrid {
-namespace kernel {
-namespace context {
-
-RawContextFactory::RawContextFactory()
- : ContextFactory("RawContextFactory")
-{
- raw_context_parallel = SIMIX_context_is_parallel();
- if (raw_context_parallel) {
-#if HAVE_THREAD_CONTEXTS
- int nthreads = SIMIX_context_get_nthreads();
- xbt_os_thread_key_create(&raw_worker_id_key);
- // TODO, lazily init
- raw_parmap = nullptr;
- raw_workers_context = new RawContext*[nthreads];
- raw_maestro_context = nullptr;
-#endif
- // TODO: choose dynamically when SIMIX_context_get_parallel_threshold() > 1
- }
-}
-
-RawContextFactory::~RawContextFactory()
-{
-#if HAVE_THREAD_CONTEXTS
- delete raw_parmap;
- delete[] raw_workers_context;
-#endif
-}
-
-RawContext* RawContextFactory::create_context(std::function<void()> code,
- void_pfn_smxprocess_t cleanup, smx_actor_t process)
-{
- return this->new_context<RawContext>(std::move(code), cleanup, process);
-}
-
-void RawContext::wrapper(void* arg)
-{
- RawContext* context = static_cast<RawContext*>(arg);
- try {
- (*context)();
- context->Context::stop();
- } catch (StopRequest const&) {
- XBT_DEBUG("Caught a StopRequest");
- }
- context->suspend();
-}
-
-RawContext::RawContext(std::function<void()> code,
- void_pfn_smxprocess_t cleanup, smx_actor_t process)
- : Context(std::move(code), cleanup, process)