super(host, name, args);
}
- @Override
public void main(String[] strings) throws MsgException {
/* get hosts 1 and 2*/
try {
poorVictim = new Victim("Boivin","victim");
poorVictim.start();
} catch (MsgException e){
- System.out.println("Cannot create the victim process!");
+ Msg.error("Cannot create the victim process!");
}
sleep(10000);
Msg.info("Resume Process");
- poorVictim.resume();
+ if (poorVictim != null)
+ poorVictim.resume();
sleep(1000);
Msg.info("Kill Process");
poorVictim.kill();
xbt_dynar_free(&d);
/* Here we are waiting for the completion of all tasks */
- sprintf(mailbox, "finalize");
-
msg_comm_t res_irecv;
XBT_ATTRIB_UNUSED msg_error_t res_wait;
for (i = 0; i < receivers_count; i++) {
task = NULL;
- res_irecv = MSG_task_irecv(&(task), mailbox);
+ res_irecv = MSG_task_irecv(&(task), "finalize");
res_wait = MSG_comm_wait(res_irecv, -1);
xbt_assert(res_wait == MSG_OK, "MSG_comm_wait failed");
MSG_comm_destroy(res_irecv);
xbt_free(task);
/* Here we tell to sender that all tasks are done */
- sprintf(mailbox, "finalize");
- res_irecv = MSG_task_isend(MSG_task_create(NULL, 0, 0, NULL), mailbox);
+ res_irecv = MSG_task_isend(MSG_task_create(NULL, 0, 0, NULL), "finalize");
MSG_comm_wait(res_irecv, -1);
MSG_comm_destroy(res_irecv);
XBT_INFO("I'm done. See you!");
msg_task_t task = NULL;
XBT_ATTRIB_UNUSED int res;
int id = -1;
- char mailbox[80];
-
- sprintf(mailbox, "jupi");
+ const char * mailbox = "jupi";
while (1) {
res = MSG_task_receive(&(task), mailbox);
double task_comp_size = 5E7;
double task_comm_size = 1E6;
- char mailbox[256];
+ const char * mailbox = "jupi";
msg_task_t task = NULL;
msg_host_t jupiter = MSG_host_by_name("Jupiter");
- sprintf(mailbox, "jupi");
task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL);
XBT_INFO("Sending \"%s\"", task->name);
static int commTX(int argc, char *argv[])
{
msg_task_t task = NULL;
- char mailbox[80];
- sprintf(mailbox, "comm");
+ const char * mailbox = "comm";
XBT_INFO(" Start TX");
task = MSG_task_create("COMM", 0, 100000000, NULL);
MSG_task_isend(task, mailbox);
static int commRX(int argc, char *argv[])
{
msg_task_t task = NULL;
- char mailbox[80];
- sprintf(mailbox, "comm");
+ const char * mailbox = "comm";
XBT_INFO(" Start RX");
msg_error_t error = MSG_task_receive(&(task), mailbox);
if (error==MSG_OK) {
double task_comm_size = 1E6;
double timeout = 1;
- char mailbox[256];
+ const char * mailbox = "jupi";
xbt_ex_t ex;
- sprintf(mailbox, "jupi");
-
msg_task_t task = MSG_task_create("normal", task_comp_size, task_comm_size, NULL);
XBT_INFO("Sending task: \"%s\"", task->name);
MSG_task_send_with_timeout(task, mailbox, timeout);
msg_task_t task;
XBT_ATTRIB_UNUSED int res;
int id = -1;
- char mailbox[80];
+ const char * mailbox = "jupi";
double start, end;
- sprintf(mailbox, "jupi");
-
+
while (1) {
task = NULL;
res = MSG_task_receive(&(task), mailbox);