-smx_activity_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t mbox,
- int type, int src, int tag,
- int (*match_fun)(void *, void *, smx_activity_t),
- void *data){
- return SIMIX_comm_iprobe(simcall->issuer, mbox, type, src, tag, match_fun, data);
-}
-
-smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type, int src,
- int tag, int (*match_fun)(void *, void *, smx_activity_t), void *data)
-{
- XBT_DEBUG("iprobe from %p %p", mbox, &mbox->comm_queue);
- simgrid::kernel::activity::CommImplPtr this_comm;
- int smx_type;
- if(type == 1){
- this_comm = simgrid::kernel::activity::CommImplPtr(new simgrid::kernel::activity::CommImpl(SIMIX_COMM_SEND));
- smx_type = SIMIX_COMM_RECEIVE;
- } else{
- this_comm = simgrid::kernel::activity::CommImplPtr(new simgrid::kernel::activity::CommImpl(SIMIX_COMM_RECEIVE));
- smx_type = SIMIX_COMM_SEND;
- }
- smx_activity_t other_synchro=nullptr;
- if (mbox->permanent_receiver != nullptr && not mbox->done_comm_queue.empty()) {
- XBT_DEBUG("first check in the permanent recv mailbox, to see if we already got something");
- other_synchro = _find_matching_comm(&mbox->done_comm_queue,
- (e_smx_comm_type_t) smx_type, match_fun, data, this_comm,/*remove_matching*/false);
- }
- if (not other_synchro) {
- XBT_DEBUG("check if we have more luck in the normal mailbox");
- other_synchro = _find_matching_comm(&mbox->comm_queue,
- (e_smx_comm_type_t) smx_type, match_fun, data, this_comm,/*remove_matching*/false);
- }
-
- return other_synchro;
-}
-