static int worker(int argc, char *argv[])
{
- msg_task_t task = NULL;
char mailbox[80];
long id= xbt_str_parse_int(argv[1], "Invalid argument %s");
while (1) {
double time1 = MSG_get_clock();
+ msg_task_t task = NULL;
int retcode = MSG_task_receive( &(task), mailbox);
double time2 = MSG_get_clock();
if (retcode == MSG_OK) {
XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
if (MSG_task_get_data(task) == FINALIZE) {
MSG_task_destroy(task);
- task = NULL;
break;
}
if (time1 < *((double *) task->data))
if (retcode == MSG_OK) {
XBT_INFO("\"%s\" done", MSG_task_get_name(task));
MSG_task_destroy(task);
- task = NULL;
} else if (retcode == MSG_HOST_FAILURE) {
XBT_INFO("Gloups. The cpu on which I'm running just turned off!. See you!");
MSG_task_destroy(task);
- task = NULL;
return 0;
} else {
XBT_INFO("Hey ?! What's up ? ");
static int policeman(int argc, char *argv[])
{
- msg_task_t task = NULL;
-
// I am the master of emigrant process,
// I tell it where it must emigrate to.
xbt_dynar_t destinations = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
char *destination;
unsigned int i;
xbt_dynar_foreach(destinations, i, destination){
- task = MSG_task_create("task", 0, 0, NULL);
+ msg_task_t task = MSG_task_create("task", 0, 0, NULL);
if (destination != NULL){
MSG_task_set_data(task, xbt_strdup (destination));
}
MSG_task_set_category(task, "migration_order");
MSG_task_send (task, "master_mailbox");
- task = NULL;
}
xbt_dynar_free (&destinations);
return 0;
storage.setUserdata(xbt_strdup("Some user data"));
XBT_INFO(" Set and get data: '%s'", (char*)storage.userdata());
-
- /*
- // Dump disks contents
- XBT_INFO("*** Dump content of %s ***",Host::current()->name());
- xbt_dict_t contents = NULL;
- contents = MSG_host_get_storage_content(MSG_host_self()); // contents is a dict of dicts
- xbt_dict_cursor_t curs, curs2 = NULL;
- char* mountname;
- xbt_dict_t content;
- char* path;
- sg_size_t *size;
- xbt_dict_foreach(contents, curs, mountname, content){
- XBT_INFO("Print the content of mount point: %s",mountname);
- xbt_dict_foreach(content,curs2,path,size){
- XBT_INFO("%s size: %llu bytes", path,*((sg_size_t*)size));
- }
- xbt_dict_free(&content);
- }
- xbt_dict_free(&contents);
- */
}
};
SD_task_get_finish_time(task));
SD_task_destroy(task);
- task=NULL;
XBT_INFO("Second test: NON TYPED task");
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_network);
-simgrid::kernel::activity::Comm::Comm(e_smx_comm_type_t _type) {
+simgrid::kernel::activity::Comm::Comm(e_smx_comm_type_t _type) : type(_type)
+{
state = SIMIX_WAITING;
- this->type = _type;
src_data=nullptr;
dst_data=nullptr;