X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e1686afc63c9643f647b5d44a64fdf4665e88ddd..a03bd071f7ec12cf9dd65b0e912fd3f84d29c880:/src/simix/xbt_context_private.h diff --git a/src/simix/xbt_context_private.h b/src/simix/xbt_context_private.h index 6797af1c24..a76e489ab9 100644 --- a/src/simix/xbt_context_private.h +++ b/src/simix/xbt_context_private.h @@ -9,8 +9,8 @@ #ifndef _XBT_CONTEXT_PRIVATE_H #define _XBT_CONTEXT_PRIVATE_H -#include "xbt/sysdep.h" -#include "simix/context.h" +/*#include "xbt/sysdep.h"*/ +#include "simix/private.h" #include "xbt/swag.h" SG_BEGIN_DECL() @@ -21,98 +21,81 @@ SG_BEGIN_DECL() /* the following function pointers types describe the interface that all context concepts must implement */ -typedef void (*xbt_pfn_context_free_t) (xbt_context_t); /* function used to destroy the specified context */ - -typedef void (*xbt_pfn_context_kill_t) (xbt_context_t); /* function used to kill the specified context */ - -typedef void (*xbt_pfn_context_schedule_t) (xbt_context_t); /* function used to resume the specified context */ - -typedef void (*xbt_pfn_context_yield_t) (void); /* function used to yield the specified context */ - -typedef void (*xbt_pfn_context_start_t) (xbt_context_t); /* function used to start the specified context */ - -typedef void (*xbt_pfn_context_stop_t) (int); /* function used to stop the current context */ - /* each context type must contain this macro at its begining -- OOP in C :/ */ #define XBT_CTX_BASE_T \ s_xbt_swag_hookup_t hookup; \ - char *name; \ - void_f_pvoid_t cleanup_func; \ - void *cleanup_arg; \ ex_ctx_t *exception; \ - int iwannadie; \ xbt_main_func_t code; \ - int argc; \ - char **argv; \ - void_f_pvoid_t startup_func; \ - void *startup_arg; \ - xbt_pfn_context_free_t free; \ - xbt_pfn_context_kill_t kill; \ - xbt_pfn_context_schedule_t schedule; \ - xbt_pfn_context_yield_t yield; \ - xbt_pfn_context_start_t start; \ - xbt_pfn_context_stop_t stop /* all other context types derive from this structure */ typedef struct s_xbt_context { XBT_CTX_BASE_T; } s_xbt_context_t; -/* ****************** */ -/* Globals definition */ -/* ****************** */ - -/* Important guys */ -extern xbt_context_t current_context; -extern xbt_context_t maestro_context; - -/* All dudes lists */ -extern xbt_swag_t context_living; -extern xbt_swag_t context_to_destroy; - /* *********************** */ /* factory type definition */ /* *********************** */ -typedef struct s_xbt_context_factory *xbt_context_factory_t; - /* The following function pointer types describe the interface that any context factory should implement */ /* function used to create a new context */ -typedef xbt_context_t (*xbt_pfn_context_factory_create_context_t) - (const char *, xbt_main_func_t, void_f_pvoid_t, void *, void_f_pvoid_t, void *, int, char **); +typedef int (*smx_pfn_context_factory_create_context_t) (smx_process_t *, xbt_main_func_t); /* function used to create the context for the maestro process */ -typedef int (*xbt_pfn_context_factory_create_maestro_context_t) (xbt_context_t*); +typedef int (*smx_pfn_context_factory_create_maestro_context_t) (smx_process_t*); /* this function finalize the specified context factory */ -typedef int (*xbt_pfn_context_factory_finalize_t) (xbt_context_factory_t*); +typedef int (*smx_pfn_context_factory_finalize_t) (smx_context_factory_t*); + +/* function used to destroy the specified context */ +typedef void (*smx_pfn_context_free_t) (smx_process_t); + +/* function used to kill the specified context */ +typedef void (*smx_pfn_context_kill_t) (smx_process_t); + +/* function used to resume the specified context */ +typedef void (*smx_pfn_context_schedule_t) (smx_process_t); + +/* function used to yield the specified context */ +typedef void (*smx_pfn_context_yield_t) (void); + +/* function used to start the specified context */ +typedef void (*smx_pfn_context_start_t) (smx_process_t); + +/* function used to stop the current context */ +typedef void (*smx_pfn_context_stop_t) (int); /* interface of the context factories */ -typedef struct s_xbt_context_factory { - xbt_pfn_context_factory_create_maestro_context_t create_maestro_context; - xbt_pfn_context_factory_create_context_t create_context; - xbt_pfn_context_factory_finalize_t finalize; +typedef struct s_smx_context_factory { + smx_pfn_context_factory_create_maestro_context_t create_maestro_context; + smx_pfn_context_factory_create_context_t create_context; + smx_pfn_context_factory_finalize_t finalize; + smx_pfn_context_free_t free; + smx_pfn_context_kill_t kill; + smx_pfn_context_schedule_t schedule; + smx_pfn_context_yield_t yield; + smx_pfn_context_start_t start; + smx_pfn_context_stop_t stop; const char *name; -} s_xbt_context_factory_t; +} s_smx_context_factory_t; /* 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 xbt_context_select_factory(const char *name); +int SIMIX_context_select_factory(const char *name); /* Initializes a context factory from the name specified by the parameter name. * If the factory cannot be found, an exception is raised. */ -void xbt_context_init_factory_by_name(xbt_context_factory_t * factory, const char *name); +void SIMIX_context_init_factory_by_name(smx_context_factory_t * factory, const char *name); /* All factories init */ -void xbt_ctx_thread_factory_init(xbt_context_factory_t * factory); +void SIMIX_ctx_thread_factory_init(smx_context_factory_t * factory); -void xbt_ctx_sysv_factory_init(xbt_context_factory_t * factory); +void SIMIX_ctx_sysv_factory_init(smx_context_factory_t * factory); -void xbt_ctx_java_factory_init(xbt_context_factory_t * factory); +void SIMIX_ctx_java_factory_init(smx_context_factory_t * factory); SG_END_DECL() #endif /* !_XBT_CONTEXT_PRIVATE_H */ \ No newline at end of file