1 /**** MSG_LICENCE DO NOT REMOVE ****/
3 #ifndef METASIMGRID_PRIVATE_H
4 #define METASIMGRID_PRIVATE_H
12 #include "xbt/context.h"
14 /**************** datatypes **********************************/
21 typedef struct sim_data_host {
22 void *host; /* SURF modeling */
23 xbt_fifo_t *mbox; /* array of FIFOs used as a mailboxes */
24 xbt_context_t *sleeping; /* array of context used to know whether a process is
25 waiting for a communication on a channel */
27 s_xbt_swag_t process_list;
30 /********************************* Task **************************************/
32 typedef struct sim_data_task {
33 surf_action_t compute; /* SURF modeling of computation */
34 surf_action_t comm; /* SURF modeling of communication */
35 double message_size; /* Data size */
36 double computation_amount; /* Computation size */
37 xbt_dynar_t sleeping; /* process to wake-up */
40 /******************************* Process *************************************/
42 typedef struct sim_data_process {
43 s_xbt_swag_hookup_t host_hookup; /* link to other process running on the same location */
44 m_host_t host; /* the host on which the process is running */
45 xbt_context_t context; /* the context that executes the scheduler fonction */
46 int PID; /* used for debugging purposes */
47 int PPID; /* The parent PID */
48 m_task_t waiting_task; /* used for debugging purposes */
49 m_host_t put_host; /* used for debugging purposes */
50 int put_channel; /* used for debugging purposes */
51 int argc; /* arguments number if any */
52 char **argv; /* arguments table if any */
53 MSG_error_t last_errno; /* the last value returned by a MSG_function */
54 } s_sim_data_process_t;
56 /************************** Global variables ********************************/
57 typedef struct MSG_Global {
60 xbt_fifo_t process_to_run;
63 m_process_t current_process;
64 xbt_dict_t registered_functions;
65 } s_MSG_global_t, *MSG_Global_t;
67 extern MSG_Global_t msg_global;
69 /*************************************************************/
71 #define PROCESS_SET_ERRNO(val) (((sim_data_process_t)(MSG_process_self()->simdata))->last_errno=val)
72 #define PROCESS_GET_ERRNO() (((sim_data_process_t)(MSG_process_self()->simdata))->last_errno)
73 #define MSG_RETURN(val) do {PROCESS_SET_ERRNO(val);return(val);} while(0)
74 /* #define CHECK_ERRNO() ASSERT((PROCESS_GET_ERRNO()!=MSG_HOST_FAILURE),"Host failed, you cannot call this function.") */
76 #define CHECK_HOST() ASSERT((((sim_data_host_t) MSG_host_self()->simdata)->state==HOST_ALIVE),"Host failed, you cannot call this function.")
78 m_task_t __MSG_task_copy(m_task_t task);
79 MSG_error_t __MSG_task_wait_event(m_process_t process, m_task_t task);
81 MSG_error_t __MSG_task_check(m_task_t task);