From: Cristian Rosa Date: Thu, 9 Aug 2012 13:17:14 +0000 (-0300) Subject: Add a new simcall to get/set the receiver of a rendez-vous point. X-Git-Tag: v3_8~174 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a45d028524d1b21fbe820ce93e87867963b7239b?hp=9c0ec517fbd653a4df3834aead473da75a1695a5 Add a new simcall to get/set the receiver of a rendez-vous point. --- diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index b3eff4dd42..ff97a5d509 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -365,8 +365,8 @@ XBT_PUBLIC(void) simcall_rdv_destroy(smx_rdv_t rvp); XBT_PUBLIC(smx_rdv_t) simcall_rdv_get_by_name(const char *name); XBT_PUBLIC(int) simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host); XBT_PUBLIC(smx_action_t) simcall_rdv_get_head(smx_rdv_t rdv); -XBT_PUBLIC(smx_process_t) SIMIX_rdv_get_receiver(smx_rdv_t rdv); -XBT_PUBLIC(void) SIMIX_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process); +XBT_PUBLIC(smx_process_t) simcall_rdv_get_receiver(smx_rdv_t rdv); +XBT_PUBLIC(void) simcall_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process); XBT_PUBLIC(xbt_dict_t) SIMIX_get_rdv_points(void); diff --git a/src/simix/smx_network_private.h b/src/simix/smx_network_private.h index 51c64cf373..558aa16a0e 100644 --- a/src/simix/smx_network_private.h +++ b/src/simix/smx_network_private.h @@ -32,6 +32,8 @@ smx_rdv_t SIMIX_rdv_get_by_name(const char *name); void SIMIX_rdv_remove(smx_rdv_t rdv, smx_action_t comm); int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host); smx_action_t SIMIX_rdv_get_head(smx_rdv_t rdv); +void SIMIX_rdv_set_receiver(smx_rdv_t rdv, smx_process_t proc); +smx_process_t SIMIX_rdv_get_receiver(smx_rdv_t rdv); void SIMIX_comm_start(smx_action_t action); void SIMIX_comm_send(smx_process_t src_proc, smx_rdv_t rdv, double task_size, double rate, diff --git a/src/simix/smx_smurf.c b/src/simix/smx_smurf.c index 55a6093c19..7278076047 100644 --- a/src/simix/smx_smurf.c +++ b/src/simix/smx_smurf.c @@ -203,6 +203,16 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value) SIMIX_simcall_answer(simcall); break; + case SIMCALL_RDV_SET_RECV: + SIMIX_rdv_set_receiver(simcall->rdv_set_rcv_proc.rdv, simcall->rdv_set_rcv_proc.receiver); + SIMIX_simcall_answer(simcall); + break; + + case SIMCALL_RDV_GET_RECV: + simcall->rdv_get_rcv_proc.result = SIMIX_rdv_get_receiver(simcall->rdv_set_rcv_proc.rdv); + SIMIX_simcall_answer(simcall); + break; + case SIMCALL_HOST_GET_BY_NAME: simcall->host_get_by_name.result = SIMIX_host_get_by_name(simcall->host_get_by_name.name); diff --git a/src/simix/smx_smurf_private.h b/src/simix/smx_smurf_private.h index 30a1018ee5..fb50e88656 100644 --- a/src/simix/smx_smurf_private.h +++ b/src/simix/smx_smurf_private.h @@ -53,6 +53,8 @@ SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_DESTROY),\ SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GEY_BY_NAME),\ SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_COMM_COUNT_BY_HOST),\ SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GET_HEAD),\ +SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_SET_RECV),\ +SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GET_RECV),\ SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_SEND),\ SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_ISEND),\ SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_RECV),\ @@ -335,6 +337,16 @@ typedef struct s_smx_simcall { smx_action_t result; } rdv_get_head; + struct { + smx_rdv_t rdv; + smx_process_t receiver; + } rdv_set_rcv_proc; + + struct { + smx_rdv_t rdv; + smx_process_t result; + } rdv_get_rcv_proc; + struct { smx_rdv_t rdv; double task_size; diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index c3074c01cb..76e288c4ce 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -809,6 +809,29 @@ smx_action_t simcall_rdv_get_head(smx_rdv_t rdv) SIMIX_simcall_push(simcall->issuer); return simcall->rdv_get_head.result; } + +void simcall_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process) +{ + smx_simcall_t simcall = SIMIX_simcall_mine(); + + simcall->call = SIMCALL_RDV_SET_RECV; + simcall->rdv_set_rcv_proc.rdv = rdv; + simcall->rdv_set_rcv_proc.receiver = process; + + SIMIX_simcall_push(simcall->issuer); +} + +smx_process_t simcall_rdv_get_receiver(smx_rdv_t rdv) +{ + smx_simcall_t simcall = SIMIX_simcall_mine(); + + simcall->call = SIMCALL_RDV_GET_RECV; + simcall->rdv_get_rcv_proc.rdv = rdv; + + SIMIX_simcall_push(simcall->issuer); + return simcall->rdv_get_rcv_proc.result; +} + /** * \ingroup simix_comm_management */