From ae11ab3b4a647d982dc92a2c7dd10fb3cb853916 Mon Sep 17 00:00:00 2001 From: navarrop Date: Wed, 7 Jul 2010 09:36:05 +0000 Subject: [PATCH] Used test with receiver. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7991 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/msg/irc_isend/deployment_peer01.xml | 1 + examples/msg/irc_isend/deployment_peer02.xml | 1 + examples/msg/irc_isend/deployment_peer03.xml | 1 + examples/msg/irc_isend/deployment_peer04.xml | 1 + examples/msg/irc_isend/peer.c | 18 +++++++++++++++--- src/msg/gos.c | 7 +++++++ 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/examples/msg/irc_isend/deployment_peer01.xml b/examples/msg/irc_isend/deployment_peer01.xml index cb449e750e..8df97ef63c 100755 --- a/examples/msg/irc_isend/deployment_peer01.xml +++ b/examples/msg/irc_isend/deployment_peer01.xml @@ -14,5 +14,6 @@ + diff --git a/examples/msg/irc_isend/deployment_peer02.xml b/examples/msg/irc_isend/deployment_peer02.xml index 23cabf6fb3..8d4c92f5f9 100755 --- a/examples/msg/irc_isend/deployment_peer02.xml +++ b/examples/msg/irc_isend/deployment_peer02.xml @@ -14,5 +14,6 @@ + diff --git a/examples/msg/irc_isend/deployment_peer03.xml b/examples/msg/irc_isend/deployment_peer03.xml index 8ffcbb8cac..734b990c35 100755 --- a/examples/msg/irc_isend/deployment_peer03.xml +++ b/examples/msg/irc_isend/deployment_peer03.xml @@ -14,5 +14,6 @@ + diff --git a/examples/msg/irc_isend/deployment_peer04.xml b/examples/msg/irc_isend/deployment_peer04.xml index 9df7712dda..08d2d563b7 100755 --- a/examples/msg/irc_isend/deployment_peer04.xml +++ b/examples/msg/irc_isend/deployment_peer04.xml @@ -14,6 +14,7 @@ + diff --git a/examples/msg/irc_isend/peer.c b/examples/msg/irc_isend/peer.c index 838f999457..2271765b56 100755 --- a/examples/msg/irc_isend/peer.c +++ b/examples/msg/irc_isend/peer.c @@ -94,7 +94,8 @@ int receiver(int argc, char *argv[]) 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]); @@ -105,9 +106,20 @@ int receiver(int argc, char *argv[]) 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); diff --git a/src/msg/gos.c b/src/msg/gos.c index b98263d5ca..6ad4005acc 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -470,7 +470,14 @@ int MSG_comm_test(msg_comm_t 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) { + 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); } -- 2.20.1