- using simix::Simcall;
- switch (req->call_) {
- case Simcall::NONE:
- return false;
-
- case Simcall::COMM_WAIT: {
- /* FIXME: check also that src and dst processes are not suspended */
- const kernel::activity::CommImpl* act = 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_actor_ == nullptr && act->state_ == simgrid::kernel::activity::State::READY)
- return (act->dst_actor_ != nullptr);
- return (act->src_actor_ && act->dst_actor_);
- }
-
- case Simcall::COMM_WAITANY: {
- simgrid::kernel::activity::CommImpl** comms = simcall_comm_waitany__get__comms(req);
- size_t count = simcall_comm_waitany__get__count(req);
- for (unsigned int index = 0; index < count; ++index) {
- auto const* comm = comms[index];
- if (comm->src_actor_ && comm->dst_actor_)
- return true;
- }
- return false;
- }
-
- default:
- /* The rest of the requests are always enabled */
- return true;
- }