- /* if a factory is already instantiated (SIMIX_context_mod_init() was called) */
- if (simix_global->context_factory != NULL) {
- /* if the desired factory is different of the current factory, call SIMIX_context_mod_exit() */
- if (strcmp(simix_global->context_factory->name, name))
- SIMIX_context_mod_exit();
- else
- /* the same context factory is requested return directly */
- return 0;
- }
-
- /* get the desired factory */
- SIMIX_context_init_factory_by_name(&simix_global->context_factory, name);
+ /* if a context factory is already instantiated and it is different from the
+ newly selected one, then kill all the processes, exit the context module
+ and initialize the new factory.
+ */