1 /* Copyright (c) 2012-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
9 msg_task_t task_message_new(e_message_type type, unsigned int len)
11 message_t msg = xbt_new(s_message_t, 1);
13 msg->prev_hostname = NULL;
14 msg->next_hostname = NULL;
15 msg_task_t task = MSG_task_create(NULL, 0, len, msg);
20 msg_task_t task_message_chain_new(const char* prev, const char *next, const unsigned int num_pieces)
22 msg_task_t task = task_message_new(MESSAGE_BUILD_CHAIN, MESSAGE_BUILD_CHAIN_SIZE);
23 message_t msg = MSG_task_get_data(task);
24 msg->prev_hostname = xbt_strdup(prev);
25 msg->next_hostname = xbt_strdup(next);
26 msg->num_pieces = num_pieces;
31 msg_task_t task_message_data_new(const char *block, unsigned int len)
33 msg_task_t task = task_message_new(MESSAGE_SEND_DATA, MESSAGE_SEND_DATA_HEADER_SIZE + len);
34 message_t msg = MSG_task_get_data(task);
35 msg->data_block = block;
36 msg->data_length = len;
41 void task_message_delete(void *task)
43 message_t msg = MSG_task_get_data(task);
45 MSG_task_destroy(task);