From: mquinson Date: Fri, 26 Nov 2010 21:45:03 +0000 (+0000) Subject: Reduce the coupling between java bindings and main lib. Core of issues, SIMIX_context... X-Git-Tag: v3_5~139 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2c78dea7647fb784b3713fba9c5234391f388c76 Reduce the coupling between java bindings and main lib. Core of issues, SIMIX_context_select_factory() is killed now that the last binding moved away from it git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8692 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/simix/private.h b/src/simix/private.h index 824a9326f8..653575e3dc 100644 --- a/src/simix/private.h +++ b/src/simix/private.h @@ -215,19 +215,11 @@ void SIMIX_context_mod_init(void); void SIMIX_context_mod_exit(void); -/* Selects a context factory associated with the name specified by the parameter name. - * If successful the function returns 0. Otherwise the function returns the error code. - */ -int SIMIX_context_select_factory(const char *name); /* All factories init */ void SIMIX_ctx_thread_factory_init(smx_context_factory_t * factory); - void SIMIX_ctx_sysv_factory_init(smx_context_factory_t * factory); - -void SIMIX_ctx_java_factory_init(smx_context_factory_t * factory); - /* ****************************** */ /* context manipulation functions */ /* ****************************** */ diff --git a/src/simix/smx_context.c b/src/simix/smx_context.c index 59638fa518..c6b9a39633 100644 --- a/src/simix/smx_context.c +++ b/src/simix/smx_context.c @@ -52,62 +52,3 @@ void SIMIX_context_mod_exit(void) (*finalize_factory) (&simix_global->context_factory); } } - -/** - * This function is used to change the context factory. - * Warning: it destroy all the existing processes (even for maestro), and it - * will create a new maestro process using the new context factory. - */ -int SIMIX_context_select_factory(const char *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. - */ - - - if (simix_global->context_factory != NULL) { - if (strcmp(simix_global->context_factory->name, name)) { - - SIMIX_process_killall(); - - /* kill maestro process */ - SIMIX_context_free(simix_global->maestro_process->context); - free(simix_global->maestro_process); - simix_global->maestro_process = NULL; - - SIMIX_context_mod_exit(); - } else - /* the same context factory is requested return directly */ - return 0; - } - - /* init the desired factory */ - smx_context_factory_t * factory = &simix_global->context_factory; - if (!strcmp(name, "thread")) -#ifdef CONTEXT_THREADS - SIMIX_ctx_thread_factory_init(factory); -#else - THROW0(not_found_error, 0, - "Factory 'thread' does not exist: thread support was not compiled in the SimGrid library"); -#endif /* CONTEXT_THREADS */ - - else if (!strcmp(name, "sysv")) -#if !defined(_XBT_WIN32) && !defined(CONTEXT_THREADS) - SIMIX_ctx_sysv_factory_init(factory); -#else - THROW0(not_found_error, 0, - "Factory 'sysv' does not exist: no System V thread support under Windows"); -#endif - - else - THROW1(not_found_error, 0, "Factory '%s' does not exist", name); - - - - - SIMIX_create_maestro_process(); - - return 0; -} - diff --git a/src/simix/smx_context_java.h b/src/simix/smx_context_java.h index 5062715e61..a60ae044b9 100644 --- a/src/simix/smx_context_java.h +++ b/src/simix/smx_context_java.h @@ -21,6 +21,7 @@ typedef struct s_smx_ctx_java { jobject jprocess; /* the java process instance binded with the msg process structure */ JNIEnv *jenv; /* jni interface pointer associated to this thread */ } s_smx_ctx_java_t, *smx_ctx_java_t; +void SIMIX_ctx_java_factory_init(smx_context_factory_t * factory); SG_END_DECL() #endif /* !_XBT_CONTEXT_JAVA_H */