- case SIMCALL_NONE:
- return false;
-
- case SIMCALL_COMM_WAIT:
- {
- /* FIXME: check also that src and dst processes are not suspended */
- simgrid::simix::Comm *act = static_cast<simgrid::simix::Comm*>(simcall_comm_wait__get__comm(req));
-
-#if HAVE_MC
- // Fetch from MCed memory:
- if (mc_model_checker != nullptr) {
- mc_model_checker->process().read(&temp_synchro, remote(act));
- act = &temp_synchro;
+ case SIMCALL_NONE:
+ return false;
+
+ case SIMCALL_COMM_WAIT: {
+ /* FIXME: check also that src and dst processes are not suspended */
+ simgrid::kernel::activity::CommImpl* act =
+ static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
+
+ if (act->src_timeout || act->dst_timeout) {
+ /* If it has a timeout it will be always be enabled (regardless of who declared the timeout),
+ * because even if the communication is not ready, it can timeout and won't block. */
+ if (_sg_mc_timeout == 1)
+ return true;
+ }
+ /* On the other hand if it hasn't a timeout, check if the comm is ready.*/
+ else if (act->detached && act->src_proc == nullptr && act->type == SIMIX_COMM_READY)
+ return (act->dst_proc != nullptr);
+ return (act->src_proc && act->dst_proc);