static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall);
static void SIMIX_comm_copy_data(smx_synchro_t comm);
-static smx_synchro_t SIMIX_comm_new(e_smx_comm_type_t type);
static inline void SIMIX_mbox_push(smx_mailbox_t mbox, smx_synchro_t comm);
static smx_synchro_t _find_matching_comm(std::deque<smx_synchro_t> *deque, e_smx_comm_type_t type,
int (*match_fun)(void *, void *,smx_synchro_t), void *user_data, smx_synchro_t my_synchro, bool remove_matching);
return (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name);
}
-smx_synchro_t SIMIX_mbox_get_head(smx_mailbox_t mbox)
-{
- return mbox->comm_queue->empty()? nullptr:mbox->comm_queue->front();
-}
-
-/**
- * \brief get the receiver (process associated to the mailbox)
- * \param mbox The rendez-vous point
- * \return process The receiving process (NULL if not set)
- */
-smx_process_t SIMIX_mbox_get_receiver(smx_mailbox_t mbox)
-{
- return mbox->permanent_receiver;
-}
-
/**
* \brief set the receiver of the rendez vous point to allow eager sends
* \param mbox The rendez-vous point
/* Communication synchros */
/******************************************************************************/
-/**
- * \brief Creates a new communicate synchro
- * \param type The direction of communication (comm_send, comm_recv)
- * \return The new communicate synchro
- */
-smx_synchro_t SIMIX_comm_new(e_smx_comm_type_t type)
-{
- simgrid::simix::Comm *comm = new simgrid::simix::Comm();
- comm->state = SIMIX_WAITING;
- comm->type = type;
- comm->refcount = 1;
- comm->src_data=NULL;
- comm->dst_data=NULL;
-
- XBT_DEBUG("Create communicate synchro %p", comm);
-
- return comm;
-}
-
/**
* \brief Destroy a communicate synchro
* \param synchro The communicate synchro to be destroyed
XBT_DEBUG("send from %p", mbox);
/* Prepare a synchro describing us, so that it gets passed to the user-provided filter of other side */
- smx_synchro_t this_synchro = SIMIX_comm_new(SIMIX_COMM_SEND);
+ smx_synchro_t this_synchro = new simgrid::simix::Comm(SIMIX_COMM_SEND);
/* Look for communication synchro matching our needs. We also provide a description of
* ourself so that the other side also gets a chance of choosing if it wants to match with us.
void *data, double rate)
{
XBT_DEBUG("recv from %p %p", mbox, mbox->comm_queue);
- smx_synchro_t this_synchro = SIMIX_comm_new(SIMIX_COMM_RECEIVE);
+ smx_synchro_t this_synchro = new simgrid::simix::Comm(SIMIX_COMM_RECEIVE);
smx_synchro_t other_synchro;
//communication already done, get it inside the fifo of completed comms
} else {
simgrid::simix::Comm *other_comm = static_cast<simgrid::simix::Comm*>(other_synchro);
- if(other_comm->surf_comm && SIMIX_comm_get_remains(other_comm)==0.0) {
+ if(other_comm->surf_comm && other_comm->remains()==0.0) {
XBT_DEBUG("comm %p has been already sent, and is finished, destroy it",other_comm);
other_comm->state = SIMIX_DONE;
other_comm->type = SIMIX_COMM_DONE;
smx_synchro_t this_synchro;
int smx_type;
if(type == 1){
- this_synchro=SIMIX_comm_new(SIMIX_COMM_SEND);
+ this_synchro = new simgrid::simix::Comm(SIMIX_COMM_SEND);
smx_type = SIMIX_COMM_RECEIVE;
} else{
- this_synchro=SIMIX_comm_new(SIMIX_COMM_RECEIVE);
+ this_synchro = new simgrid::simix::Comm(SIMIX_COMM_RECEIVE);
smx_type = SIMIX_COMM_SEND;
}
smx_synchro_t other_synchro=NULL;
/************* synchro Getters **************/
-/**
- * \brief get the amount remaining from the communication
- * \param synchro The communication
- */
-double SIMIX_comm_get_remains(smx_synchro_t synchro)
-{
- if(!synchro)
- return 0;
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- double remains;
- switch (synchro->state) {
-
- case SIMIX_RUNNING:
- remains = comm->surf_comm->getRemains();
- break;
-
- case SIMIX_WAITING:
- case SIMIX_READY:
- remains = 0; /*FIXME: check what should be returned */
- break;
-
- default:
- remains = 0; /*FIXME: is this correct? */
- break;
- }
- return remains;
-}
-
-e_smx_state_t SIMIX_comm_get_state(smx_synchro_t synchro)
-{
- return synchro->state;
-}
-
/**
* \brief Return the user data associated to the sender of the communication
* \param synchro The communication