X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4272e5735e685afc759b02dfbcb08acaf462c791..aec69a3f489dd93266830ffceed079447d156d35:/src/xbt/xbt_context.c diff --git a/src/xbt/xbt_context.c b/src/xbt/xbt_context.c index f3c9ecd62a..8774486165 100644 --- a/src/xbt/xbt_context.c +++ b/src/xbt/xbt_context.c @@ -10,7 +10,7 @@ #include "portable.h" #include "xbt/log.h" #include "xbt/swag.h" -#include "xbt_context_factory.h" +#include "xbt_context_private.h" /* the context associated with the current process */ xbt_context_t current_context = NULL; @@ -50,10 +50,10 @@ xbt_context_mod_init(void) #ifdef CONTEXT_THREADS /* context switch based os thread */ - xbt_thread_context_factory_init(&context_factory); + xbt_ctx_thread_factory_init(&context_factory); #elif !defined(WIN32) /* context switch based ucontext */ - xbt_ucontext_factory_init(&context_factory); + xbt_ctx_sysv_factory_init(&context_factory); #else /* context switch is not allowed on Windows */ #error ERROR [__FILE__, line __LINE__]: no context based implementation specified. @@ -244,15 +244,10 @@ xbt_context_select_factory(const char* name) { /* if the desired factory is different of the current factory, call xbt_context_mod_exit() */ if(strcmp(context_factory->name,name)) - { xbt_context_mod_exit(); - - } else - { /* the same context factory is requested return directly */ return 0; - } } /* get the desired factory */ @@ -277,26 +272,20 @@ xbt_context_select_factory(const char* name) return 0; } -int +void xbt_context_init_factory_by_name(xbt_context_factory_t* factory, const char* name) { - if(!strcmp(name,"jcontext_factory")) - { - return xbt_jcontext_factory_init(factory); - } - #ifdef CONTEXT_THREADS - else if(!strcmp(name,"thread_context_factory")) - { - return xbt_thread_context_factory_init(factory); - } - #elif !defined(WIN32) - else if(!strcmp(name,"ucontext_context_factory")) - { - return xbt_ucontext_factory_init(factory); - } - #endif - - return EINVAL; + if(!strcmp(name,"java")) + xbt_ctx_java_factory_init(factory); +#ifdef CONTEXT_THREADS + else if(!strcmp(name,"thread")) + xbt_ctx_thread_factory_init(factory); +#elif !defined(WIN32) + else if(!strcmp(name,"sysv")) + xbt_ctx_sysv_factory_init(factory); +#endif + else + THROW1(not_found_error, 0,"Factory '%s' does not exist",name); } /** Garbage collection