From: alegrand Date: Fri, 17 Dec 2004 21:29:11 +0000 (+0000) Subject: Cosmetics X-Git-Tag: v3.3~4671 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/710e7c0ce3fce936637636f544019e89e8ef023d Cosmetics git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@679 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/include/msg/msg.h b/include/msg/msg.h index 98d685d258..a36cefdcf0 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -77,7 +77,7 @@ MSG_error_t MSG_task_put(m_task_t task, m_host_t dest, 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 ***************************************/ diff --git a/src/msg/gos.c b/src/msg/gos.c index ccdd24a1e6..d167c7a4e6 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -9,7 +9,7 @@ #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. diff --git a/src/msg/m_process.c b/src/msg/m_process.c index d3e1dbd1f8..15ec2c972b 100644 --- a/src/msg/m_process.c +++ b/src/msg/m_process.c @@ -49,8 +49,6 @@ m_process_t MSG_process_create(const char *name, simdata->PID = PID++; simdata->host = host; simdata->waiting_task = NULL; - simdata->put_host = NULL; - simdata->put_channel = -1; simdata->argc = -1; simdata->argv = NULL; simdata->context = xbt_context_new(code, simdata->argc, simdata->argv); diff --git a/src/msg/private.h b/src/msg/private.h index ad8c31ead6..6e485d4424 100644 --- a/src/msg/private.h +++ b/src/msg/private.h @@ -18,17 +18,11 @@ /**************** 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; @@ -40,6 +34,8 @@ typedef struct simdata_task { 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 *************************************/ @@ -50,8 +46,6 @@ typedef struct simdata_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 */ @@ -66,7 +60,7 @@ typedef struct MSG_Global { 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; @@ -77,7 +71,9 @@ 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); diff --git a/src/msg/task.c b/src/msg/task.c index 552c95a20c..d0f600166c 100644 --- a/src/msg/task.c +++ b/src/msg/task.c @@ -48,6 +48,8 @@ m_task_t MSG_task_create(const char *name, long double compute_duration, 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; } @@ -81,6 +83,9 @@ MSG_error_t MSG_task_destroy(m_task_t 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));