+ (*factory)->finalize = smx_ctx_raw_factory_finalize;
+ (*factory)->create_context = smx_ctx_raw_create_context;
+ /* Do not overload that method (*factory)->finalize */
+ (*factory)->free = smx_ctx_raw_free;
+ (*factory)->stop = smx_ctx_raw_stop;
+ (*factory)->name = "smx_raw_context_factory";
+
+ if (SIMIX_context_is_parallel()) {
+#ifdef CONTEXT_THREADS
+ int nthreads = SIMIX_context_get_nthreads();
+ raw_parmap = xbt_parmap_new(nthreads, SIMIX_context_get_parallel_mode());
+ raw_workers_stacks = xbt_new(raw_stack_t, nthreads);
+ xbt_os_thread_key_create(&raw_worker_id_key);
+#endif
+ if (SIMIX_context_get_parallel_threshold() > 1) {
+ /* choose dynamically */
+ (*factory)->runall = smx_ctx_raw_runall;
+ (*factory)->suspend = NULL;
+ }
+ else {
+ /* always parallel */
+ (*factory)->runall = smx_ctx_raw_runall_parallel;
+ (*factory)->suspend = smx_ctx_raw_suspend_parallel;
+ }
+ }
+ else {
+ /* always serial */
+ (*factory)->runall = smx_ctx_raw_runall_serial;
+ (*factory)->suspend = smx_ctx_raw_suspend_serial;
+ }
+#ifdef TIME_BENCH_PER_SR
+ timer = xbt_os_timer_new();
+#endif
+}
+
+/**
+ * \brief Finalizes the raw context factory.
+ * \param factory the raw context factory
+ */