- 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);
-#else
-#error ERROR [__FILE__, line __LINE__]: no context implementation specified.
-#endif
+ else { /* use the factory specified by --cfg=simix/ctx:value */
+ if (smx_context_factory_name == NULL || !strcmp(smx_context_factory_name, "ucontext")) {
+ /* use ucontext */
+ SIMIX_ctx_sysv_factory_init(&simix_global->context_factory);
+ }
+ else if (!strcmp(smx_context_factory_name, "thread")) {
+ /* use os threads (either pthreads or windows ones) */
+ SIMIX_ctx_thread_factory_init(&simix_global->context_factory);
+ }
+ else if (!strcmp(smx_context_factory_name, "raw")) {
+ /* use raw contexts */
+ SIMIX_ctx_raw_factory_init(&simix_global->context_factory);
+ }
+ else {
+ xbt_die("Invalid context factory specified");
+ }