X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7ca4c132b1f3a64287b8c1cc0c8f9822fa761616..14ed9eee4934531af1507c9ddf002876e93fc67d:/src/simix/smx_private.h diff --git a/src/simix/smx_private.h b/src/simix/smx_private.h index fcf7fd10a6..b591a57347 100644 --- a/src/simix/smx_private.h +++ b/src/simix/smx_private.h @@ -24,12 +24,10 @@ #include "smx_network_private.h" #include "smx_smurf_private.h" #include "smx_synchro_private.h" - -#ifdef _XBT_WIN32 -# include /* context relative declarations */ -#else -# include /* context relative declarations */ -#endif +/* ****************************************************************************************** */ +/* TUTORIAL: New API */ +/* ****************************************************************************************** */ +#include "smx_new_api_private.h" /* Define only for SimGrid benchmarking purposes */ //#define TIME_BENCH_PER_SR /* this aims at measuring the time spent in each scheduling round per each thread. The code is thus run in sequential to bench separately each SSR */ @@ -75,12 +73,9 @@ extern xbt_dict_t watched_hosts_lib; /* ******************************** File ************************************ */ typedef struct s_smx_file { surf_file_t surf_file; + void* data; /**< @brief user data */ } s_smx_file_t; -typedef struct s_smx_stat { - s_file_stat_t surf_stat; -} s_smx_stat_t; - /*********************************** Time ************************************/ /** @brief Timer datatype */ @@ -98,7 +93,11 @@ typedef enum { SIMIX_ACTION_COMMUNICATE, SIMIX_ACTION_SLEEP, SIMIX_ACTION_SYNCHRO, - SIMIX_ACTION_IO + SIMIX_ACTION_IO, + /* ****************************************************************************************** */ + /* TUTORIAL: New API */ + /* ****************************************************************************************** */ + SIMIX_ACTION_NEW_API } e_smx_action_type_t; typedef enum { @@ -134,6 +133,12 @@ typedef struct s_smx_action { struct { e_smx_comm_type_t type; /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */ smx_rdv_t rdv; /* Rendez-vous where the comm is queued */ + +#ifdef HAVE_MC + smx_rdv_t rdv_cpy; /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR + (comm.rdv set to NULL when the communication is removed from the mailbox + (used as garbage collector)) */ +#endif int refcount; /* Number of processes involved in the cond */ int detached; /* If detached or not */ @@ -175,6 +180,13 @@ typedef struct s_smx_action { smx_host_t host; surf_action_t surf_io; } io; + + /* ****************************************************************************************** */ + /* TUTORIAL: New API */ + /* ****************************************************************************************** */ + struct { + surf_action_t surf_new_api; + } new_api; }; #ifdef HAVE_LATENCY_BOUND_TRACKING @@ -211,15 +223,6 @@ smx_context_t SIMIX_context_get_current(void); /* All factories init */ -typedef struct s_smx_ctx_sysv { - s_smx_ctx_base_t super; /* Fields of super implementation */ - ucontext_t uc; /* the ucontext that executes the code */ -#ifdef HAVE_VALGRIND_VALGRIND_H - unsigned int valgrind_stack_id; /* the valgrind stack id */ -#endif - char stack[0]; /* the thread stack (must remain the last element of the structure) */ -} s_smx_ctx_sysv_t, *smx_ctx_sysv_t; - 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_raw_factory_init(smx_context_factory_t *factory); @@ -258,7 +261,8 @@ static XBT_INLINE smx_context_t SIMIX_context_new(xbt_main_func_t code, void_pfn_smxprocess_t cleanup_func, smx_process_t simix_process) { - + if (!simix_global) + xbt_die("simix is not initialized, please call MSG_init first"); return simix_global->context_factory->create_context(code, argc, argv, cleanup_func, @@ -299,7 +303,9 @@ static XBT_INLINE void SIMIX_context_suspend(smx_context_t context) */ static XBT_INLINE void SIMIX_context_runall(void) { - simix_global->context_factory->runall(); + if (!xbt_dynar_is_empty(simix_global->process_to_run)) { + simix_global->context_factory->runall(); + } } /** @@ -310,7 +316,6 @@ static XBT_INLINE smx_context_t SIMIX_context_self(void) if (simix_global && simix_global->context_factory) { return simix_global->context_factory->self(); } - return NULL; }