From 5017a96d2e904e414c63e86137f7ab814724b362 Mon Sep 17 00:00:00 2001 From: navarrop Date: Thu, 1 Jul 2010 12:10:29 +0000 Subject: [PATCH] Add some fct to simix for function wait in gos.c git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7955 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/include/simix/simix.h | 5 +++++ src/msg/gos.c | 13 +++++++++---- src/simix/smx_network.c | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/include/simix/simix.h b/src/include/simix/simix.h index 7b9cb19973..d673c4ecc0 100644 --- a/src/include/simix/simix.h +++ b/src/include/simix/simix.h @@ -212,6 +212,11 @@ XBT_PUBLIC(void) SIMIX_communication_destroy(smx_comm_t comm); XBT_PUBLIC(double) SIMIX_communication_get_remains(smx_comm_t comm); XBT_PUBLIC(void *) SIMIX_communication_get_data(smx_comm_t comm); +XBT_PUBLIC(void *) SIMIX_communication_get_src_buf(smx_comm_t comm); +XBT_PUBLIC(void *) SIMIX_communication_get_dst_buf(smx_comm_t comm); +XBT_PUBLIC(void *) SIMIX_communication_get_src_buf_size(smx_comm_t comm); +XBT_PUBLIC(void *) SIMIX_communication_get_dst_buf_size(smx_comm_t comm); + /*****Networking*****/ XBT_PUBLIC(void) SIMIX_network_set_copy_data_callback(void (*callback)(smx_comm_t, size_t)); XBT_PUBLIC(void) SIMIX_network_copy_pointer_callback(smx_comm_t comm, size_t buff_size); diff --git a/src/msg/gos.c b/src/msg/gos.c index 54b4fa8984..f59e937a9f 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -48,7 +48,6 @@ MSG_error_t MSG_task_execute(m_task_t task) TRACE_msg_task_execute_start (task); #endif - xbt_assert1((!simdata->compute) && (task->simdata->refcount == 1), "This task is executed somewhere else. Go fix your code! %d", task->simdata->refcount); @@ -427,7 +426,6 @@ msg_comm_t MSG_task_isend(m_task_t task, const char *alias) { t_simdata->refcount++; msg_global->sent_msg++; - process->simdata->waiting_task = task; /* Send it by calling SIMIX network layer */ @@ -469,12 +467,19 @@ msg_comm_t MSG_task_irecv(m_task_t * task, const char *alias) { int MSG_comm_test(msg_comm_t comm) { return SIMIX_network_test(comm); } -MSG_error_t MSG_comm_wait(msg_comm_t comm,double timeout) { + +MSG_error_t MSG_comm_wait(msg_comm_t comm, double timeout) { xbt_ex_t e; MSG_error_t res = MSG_OK; TRY { SIMIX_network_wait(comm,timeout); - // (*task)->simdata->refcount--; + + if(!(comm->src_proc == SIMIX_process_self())) + { + m_task_t task; + task = (m_task_t) SIMIX_communication_get_src_buf(comm); + task->simdata->refcount--; + } /* FIXME: these functions are not tracable */ } CATCH(e){ diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 923173b5d7..53af644ba6 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -436,6 +436,23 @@ XBT_INLINE void *SIMIX_communication_get_data(smx_comm_t comm) return comm->data; } +XBT_PUBLIC(void *) SIMIX_communication_get_src_buf(smx_comm_t comm) +{ + return comm->src_buff; +} +XBT_PUBLIC(void *) SIMIX_communication_get_dst_buf(smx_comm_t comm) +{ + return comm->dst_buff; +} +XBT_PUBLIC(void *) SIMIX_communication_get_src_buf_size(smx_comm_t comm) +{ + return comm->src_buff_size; +} +XBT_PUBLIC(void *) SIMIX_communication_get_dst_buf_size(smx_comm_t comm) +{ + return comm->dst_buff_size; +} + /******************************************************************************/ /* Synchronous Communication */ /******************************************************************************/ -- 2.20.1