예제 #1
0
void RawContext::resume_parallel()
{
#if HAVE_THREAD_CONTEXTS
  uintptr_t worker_id = __sync_fetch_and_add(&raw_threads_working, 1);
  xbt_os_thread_set_specific(raw_worker_id_key, (void*) worker_id);
  RawContext* worker_context = (RawContext*) SIMIX_context_self();
  raw_workers_context[worker_id] = worker_context;
  XBT_DEBUG("Saving worker stack %zu", worker_id);
  SIMIX_context_set_current(this);
  raw_swapcontext(&worker_context->stack_top_, this->stack_top_);
#else
  xbt_die("Parallel execution disabled");
#endif
}
예제 #2
0
void BoostParallelContext::resume()
{
  unsigned long worker_id = __sync_fetch_and_add(&threads_working_, 1);
  xbt_os_thread_set_specific(worker_id_key_, (void*) worker_id);

  BoostParallelContext* worker_context =
    static_cast<BoostParallelContext*>(SIMIX_context_self());
  workers_context_[worker_id] = worker_context;

  SIMIX_context_set_current(this);
#if HAVE_BOOST_CONTEXTS == 1
  boost::context::jump_fcontext(
    worker_context->fc_, this->fc_, (intptr_t) this);
#else
  boost::context::jump_fcontext(
    &worker_context->fc_, this->fc_, (intptr_t) this);
#endif
}
예제 #3
0
static void smx_ctx_boost_resume_parallel(smx_process_t process)
{
  unsigned long worker_id = __sync_fetch_and_add(&boost_threads_working, 1);
  xbt_os_thread_set_specific(boost_worker_id_key, (void*) worker_id);

  smx_ctx_boost_t worker_context = (smx_ctx_boost_t)SIMIX_context_self();
  boost_workers_context[worker_id] = worker_context;
  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
}