- msg_task_t task = NULL;
- XBT_ATTRIB_UNUSED int res;
- if (host_number == 0){ //root: send then receive
- sprintf(mailbox, "%d", host_number+1);
- task = MSG_task_create("Token", task_comp_size, task_comm_size, NULL);
- XBT_INFO("Host \"%d\" send '%s' to Host \"%s\"",host_number,task->name,mailbox);
+
+ if (rank == 0) {
+ /* The root process (rank 0) first sends the token then waits to receive it back */
+ snprintf(mailbox,255, "%d", rank+1);
+ msg_task_t task = MSG_task_create("Token", 0, task_comm_size, NULL);
+ XBT_INFO("Host \"%d\" send '%s' to Host \"%s\"", rank, task->name,mailbox);