m_channel_t channel);
MSG_error_t MSG_task_execute(m_task_t task);
int MSG_task_Iprobe(m_channel_t channel);
-void MSG_process_sleep(long double nb_sec);
+MSG_error_t MSG_process_sleep(long double nb_sec);
MSG_error_t MSG_get_errno(void);
/************************** Deprecated ***************************************/
#include"xbt/sysdep.h"
#include "xbt/error.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gos, msg,
- "Logging specific to MSG (process)");
+ "Logging specific to MSG (gos)");
/** \ingroup msg_gos_functions
* \brief This function is now deprecated and useless. Please stop using it.
/**************** datatypes **********************************/
-typedef enum {
- HOST_DOWN = 0,
- HOST_ALIVE = 1
-} m_host_state_t;
-
typedef struct simdata_host {
void *host; /* SURF modeling */
xbt_fifo_t *mbox; /* array of FIFOs used as a mailboxes */
m_process_t *sleeping; /* array of process used to know whether a local process is
waiting for a communication on a channel */
- m_host_state_t state;
xbt_fifo_t process_list;
} s_simdata_host_t;
double message_size; /* Data size */
double computation_amount; /* Computation size */
xbt_dynar_t sleeping; /* process to wake-up */
+ m_process_t sender;
+ int using;
} s_simdata_task_t;
/******************************* Process *************************************/
int PID; /* used for debugging purposes */
int PPID; /* The parent PID */
m_task_t waiting_task;
- m_host_t put_host; /* used for debugging purposes */
- int put_channel; /* used for debugging purposes */
int argc; /* arguments number if any */
char **argv; /* arguments table if any */
MSG_error_t last_errno; /* the last value returned by a MSG_function */
int max_channel;
m_process_t current_process;
xbt_dict_t registered_functions;
-} s_MSG_global_t, *MSG_Global_t;
+} s_MSG_Global_t, *MSG_Global_t;
extern MSG_Global_t msg_global;
#define MSG_RETURN(val) do {PROCESS_SET_ERRNO(val);return(val);} while(0)
/* #define CHECK_ERRNO() ASSERT((PROCESS_GET_ERRNO()!=MSG_HOST_FAILURE),"Host failed, you cannot call this function.") */
-#define CHECK_HOST() xbt_assert0((MSG_host_self()->simdata->state==HOST_ALIVE),"Host failed, you cannot call this function.")
+#define CHECK_HOST() xbt_assert0(surf_workstation_resource->extension_public-> \
+ get_state(MSG_host_self()->simdata->host)==SURF_CPU_ON,\
+ "Host failed, you cannot call this function.")
m_host_t __MSG_host_create(const char *name, void *workstation,
void *data);
simdata->sleeping = xbt_dynar_new(sizeof(m_process_t),NULL);
simdata->computation_amount = compute_duration;
simdata->message_size = message_size;
+ simdata->using = 1;
+ simdata->sender = NULL;
return task;
}
xbt_assert0((xbt_dynar_length(task->simdata->sleeping)==0),
"Task still used. Cannot destroy it now!");
+ task->simdata->using--;
+ if(task->simdata->using>0) return MSG_OK;
+
if(task->name) xbt_free(task->name);
xbt_dynar_free(&(task->simdata->sleeping));