- /* select context factory to use to create the context(depends of the macro definitions) */
-
-#ifdef CONTEXT_THREADS
- /* context switch based os thread */
- SIMIX_ctx_thread_factory_init(&simix_global->context_factory);
-#elif !defined(WIN32)
- /* context switch based ucontext */
- SIMIX_ctx_sysv_factory_init(&simix_global->context_factory);
+ /* select context factory to use to create the context(depends of the macro definitions) */
+ if (factory_initializer_to_use) {
+ (*factory_initializer_to_use)(&(simix_global->context_factory));
+ } else {
+#ifdef CONTEXT_THREADS /* Use os threads (either pthreads or windows ones) */
+ SIMIX_ctx_thread_factory_init(&simix_global->context_factory);
+#elif defined(CONTEXT_UCONTEXT) /* use ucontext */
+ SIMIX_ctx_sysv_factory_init(&simix_global->context_factory);