- else
- mailbox = smpi_process_mailbox();
- // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later
- request->real_size=request->size;
- smpi_datatype_use(request->old_type);
- smpi_comm_use(request->comm);
- request->action = simcall_comm_irecv(mailbox, request->buf,
- &request->real_size, &match_recv,
- &smpi_comm_copy_buffer_callback,
- request, -1.0);
+ XBT_DEBUG("Is there a corresponding send already posted in the small mailbox %p (in case of SSEND)?", mailbox);
+ smx_synchro_t action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request);
+
+ if(action ==NULL){
+ mailbox = smpi_process_mailbox();
+ XBT_DEBUG("No, nothing in the small mailbox test the other one : %p", mailbox);
+ action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request);
+ if(action ==NULL){
+ XBT_DEBUG("Still nothing, switch back to the small mailbox : %p", mailbox);
+ mailbox = smpi_process_mailbox_small();
+ }
+ }else{
+ XBT_DEBUG("yes there was something for us in the large mailbox");
+ }
+ }else{
+ mailbox = smpi_process_mailbox_small();
+ XBT_DEBUG("Is there a corresponding send already posted the small mailbox?");
+ smx_synchro_t action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request);
+
+ if(action ==NULL){
+ XBT_DEBUG("No, nothing in the permanent receive mailbox");
+ mailbox = smpi_process_mailbox();
+ }else{
+ XBT_DEBUG("yes there was something for us in the small mailbox");
+ }
+ }