return value;
}
-
-/* Helper function */
-static double parse_double(const char *string)
-{
- double value;
- char *endptr;
-
- value = strtod(string, &endptr);
- if (*endptr != '\0')
- THROW1(unknown_error, 0, "%s is not a double", string);
- return value;
-}
-
-
/* My actions */
static void send(xbt_dynar_t action)
{
const char *gras_os_myname(void)
{
- smx_process_t process = SIMIX_process_self();
- if (process != NULL)
+ smx_host_t host = SIMIX_host_self();
+ if (host != NULL)
return SIMIX_host_get_name(SIMIX_host_self());
else
return "";
#include "xbt/fifo.h"
#include "xbt/swag.h"
#include "xbt/dict.h"
-#include "xbt/config.h"
#include "xbt/function_types.h"
/******************************** Datatypes ***********************************/
/*********************************** Host *************************************/
-/** @brief Host datatype
+/** @brief Host datatype
@ingroup m_datatypes_management_details */
typedef struct s_smx_host {
char *name; /**< @brief host name if any */
typedef struct s_smx_context *smx_context_t;
-/** @brief Process datatype
+/** @brief Process datatype
@ingroup m_datatypes_management_details @{ */
typedef struct s_smx_process {
s_xbt_swag_hookup_t process_hookup;
/********************************* Action *************************************/
-/** @brief Action datatype
+/** @brief Action datatype
@ingroup m_datatypes_management_details */
typedef struct s_smx_action {
char *name; /**< @brief action name if any */
/************************** Configuration support *****************************/
-void simix_config_init(void); /* create the config set, call this before use! */
-void simix_config_finalize(void); /* destroy the config set, call this at cleanup. */
-extern int _simix_init_status; /* 0: beginning of time;
- 1: pre-inited (cfg_set created);
+extern int _simix_init_status; /* 0: beginning of time; FIXME: KILLME ?
+ 1: pre-inited (cfg_set created);
2: inited (running) */
-extern xbt_cfg_t _simix_cfg_set;
-
-#define SIMIX_CHECK_HOST() xbt_assert0(surf_workstation_model->extension_public-> \
- get_state(SIMIX_host_self()->host)==SURF_CPU_ON,\
+#define SIMIX_CHECK_HOST() xbt_assert0(surf_workstation_model->extension.workstation. \
+ get_state(SIMIX_host_self()->host)==SURF_RESOURCE_ON,\
"Host failed, you cannot call this function.")
smx_host_t __SIMIX_host_create(const char *name, void *workstation, void *data);
void SIMIX_context_yield(void);
void SIMIX_context_schedule(smx_process_t process);
-
+
void SIMIX_context_empty_trash(void);
void SIMIX_context_stop(int exit_code);
-
+
void SIMIX_context_free(smx_process_t process);
void SIMIX_context_mod_init(void);
/* check if the host is active */
if (surf_workstation_model->extension.
- workstation.get_state(host->>host) != SURF_RESOURCE_ON) {
+ workstation.get_state(host->host) != SURF_RESOURCE_ON) {
THROW1(host_error, 0, "Host %s failed, you cannot call this function",
host->name);
}
computation_amount,
communication_amount, amount, rate);
- surf_workstation_model->action_data_set(simdata->surf_action, act);
+ surf_workstation_model->action_data_set(act->surf_action, act);
return act;
}
SIMIX_cond_broadcast(cond);
return;
-}
\ No newline at end of file
+}
void SIMIX_global_init(int *argc, char **argv)
{
s_smx_process_t proc;
-
+
if (!simix_global) {
/* Connect our log channels: that must be done manually under windows */
XBT_LOG_CONNECT(simix_action, simix);
SIMIX_context_mod_init();
__SIMIX_create_maestro_process();
-
+
/* Prepare to display some more info when dying on Ctrl-C pressing */
signal(SIGINT, inthandler);
surf_init(argc, argv); /* Initialize SURF structures */
{
/* Kill everyone (except maestro) */
SIMIX_process_killall();
-
- simix_config_finalize();
-
+
/* Free the remaining data structures*/
xbt_swag_free(simix_global->process_to_run);
xbt_swag_free(simix_global->process_to_destroy);
simix_global->process_list = NULL;
xbt_dict_free(&(simix_global->registered_functions));
xbt_dict_free(&(simix_global->host));
-
+
/* Let's free maestro now */
SIMIX_context_free(simix_global->maestro_process);
- free(simix_global->maestro_process);
+ free(simix_global->maestro_process);
/* Finish context module and SURF */
SIMIX_context_mod_exit();
surf_exit();
-
+
free(simix_global);
simix_global = NULL;
-
+
return;
}
/* Set it as the maestro process */
simix_global->maestro_process = process;
simix_global->current_process = process;
-
+
return;
}
-/**
+/**
* \brief Creates and runs a new #smx_process_t.
*
* A constructor for #m_process_t taking four arguments and returning the corresponding object. The structure (and the corresponding thread) is created, and put in the list of ready process.
*/
int SIMIX_process_is_suspended(smx_process_t process)
{
- xbt_assert0(((process != NULL), "Invalid parameters");
+ xbt_assert0((process != NULL), "Invalid parameters");
return (process->suspended);
}