git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7991
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
<process host="Ruby" function="receiver">
<argument value="0"/>
<argument value="1"/> <!-- Sleep_start_time -->
<process host="Ruby" function="receiver">
<argument value="0"/>
<argument value="1"/> <!-- Sleep_start_time -->
+ <argument value="0.1"/> <!-- Time for test -->
<process host="Ruby" function="receiver">
<argument value="0"/>
<argument value="5"/> <!-- Sleep_start_time -->
<process host="Ruby" function="receiver">
<argument value="0"/>
<argument value="5"/> <!-- Sleep_start_time -->
+ <argument value="0.1"/> <!-- Time for test -->
<process host="Ruby" function="receiver">
<argument value="0"/>
<argument value="1"/> <!-- Sleep_start_time -->
<process host="Ruby" function="receiver">
<argument value="0"/>
<argument value="1"/> <!-- Sleep_start_time -->
+ <argument value="0"/> <!-- Time for test -->
<process host="Ruby" function="receiver">
<argument value="0"/>
<argument value="5"/> <!-- Sleep_start_time -->
<process host="Ruby" function="receiver">
<argument value="0"/>
<argument value="5"/> <!-- Sleep_start_time -->
+ <argument value="0"/> <!-- Time for test -->
char mailbox[80];
msg_comm_t res_irecv;
double sleep_start_time = atof(argv[2]);
char mailbox[80];
msg_comm_t res_irecv;
double sleep_start_time = atof(argv[2]);
- INFO1("sleep_start_time : %f ",sleep_start_time);
+ double sleep_test_time = atof(argv[3]);
+ INFO2("sleep_start_time : %f , sleep_test_time : %f",sleep_start_time,sleep_test_time);
xbt_assert1(sscanf(argv[1],"%d", &id),
"Invalid argument %s\n",argv[1]);
xbt_assert1(sscanf(argv[1],"%d", &id),
"Invalid argument %s\n",argv[1]);
while(1) {
res_irecv = MSG_task_irecv(&(task), mailbox);
INFO0("Wait to receive a task");
while(1) {
res_irecv = MSG_task_irecv(&(task), mailbox);
INFO0("Wait to receive a task");
- res = MSG_comm_wait(res_irecv,-1);
- xbt_assert0(res == MSG_OK, "MSG_task_get failed");
+ if(sleep_test_time == 0)
+ {
+ res = MSG_comm_wait(res_irecv,-1);
+ xbt_assert0(res == MSG_OK, "MSG_task_get failed");
+ }
+ else
+ {
+ while(MSG_comm_test(res_irecv) == 0){
+ MSG_process_sleep (sleep_test_time);
+ };
+ MSG_comm_destroy(res_irecv);
+ }
+
INFO1("Received \"%s\"", MSG_task_get_name(task));
if (!strcmp(MSG_task_get_name(task),"finalize")) {
MSG_task_destroy(task);
INFO1("Received \"%s\"", MSG_task_get_name(task));
if (!strcmp(MSG_task_get_name(task),"finalize")) {
MSG_task_destroy(task);
return SIMIX_network_test(comm);
}
return SIMIX_network_test(comm);
}
+/* After received TRUE to MSG_comm_test() function we have to destroy the communication */
void MSG_comm_destroy(msg_comm_t comm) {
void MSG_comm_destroy(msg_comm_t comm) {
+ if(!(comm->src_proc == SIMIX_process_self()))
+ {
+ m_task_t task;
+ task = (m_task_t) SIMIX_communication_get_src_buf(comm);
+ task->simdata->refcount--;
+ }
SIMIX_communication_destroy(comm);
}
SIMIX_communication_destroy(comm);
}