- unsigned long worker_id = xbt_parmap_get_worker_id(raw_parmap);
- raw_stack_t* worker_stack = &raw_workers_stacks[worker_id];
+ unsigned long worker_id = __sync_fetch_and_add(&raw_threads_working, 1);
+ xbt_os_thread_set_specific(raw_worker_id_key, (void*) worker_id);
+ smx_ctx_raw_t worker_context = (smx_ctx_raw_t)SIMIX_context_self();
+ raw_workers_context[worker_id] = worker_context;
+ XBT_DEBUG("Saving worker stack %lu", worker_id);
+ raw_stack_t* worker_stack = &(worker_context)->stack_top;
+