-}
-
-// Called from both MCer and MCed:
-bool request_is_enabled(smx_simcall_t req)
-{
- unsigned int index = 0;
- smx_synchro_t act = 0;
-#if HAVE_MC
- s_smx_synchro_t temp_synchro;
-#endif
-
- switch (req->call) {
- case SIMCALL_NONE:
- return false;
-
- case SIMCALL_COMM_WAIT:
- /* FIXME: check also that src and dst processes are not suspended */
- act = simcall_comm_wait__get__comm(req);
-
-#if HAVE_MC
- // Fetch from MCed memory:
- if (mc_mode == MC_MODE_SERVER) {
- mc_model_checker->process().read(&temp_synchro, remote(act));
- act = &temp_synchro;
- }
-#endif
-
- if (simcall_comm_wait__get__timeout(req) >= 0) {
- /* If it has a timeout it will be always be enabled, 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->comm.detached && act->comm.src_proc == nullptr
- && act->comm.type == SIMIX_COMM_READY)
- return (act->comm.dst_proc != nullptr);
- return (act->comm.src_proc && act->comm.dst_proc);
-
- case SIMCALL_COMM_WAITANY: {
- xbt_dynar_t comms;
-#if HAVE_MC
-
- s_xbt_dynar_t comms_buffer;
- size_t buffer_size = 0;
- if (mc_mode == MC_MODE_SERVER) {
- // Read dynar:
- mc_model_checker->process().read(
- &comms_buffer, remote(simcall_comm_waitany__get__comms(req)));
- assert(comms_buffer.elmsize == sizeof(act));
- buffer_size = comms_buffer.elmsize * comms_buffer.used;
- comms = &comms_buffer;
- } else
- comms = simcall_comm_waitany__get__comms(req);
-
- // Read all the dynar buffer:
- char buffer[buffer_size];
- if (mc_mode == MC_MODE_SERVER)
- mc_model_checker->process().read_bytes(buffer, sizeof(buffer),
- remote(comms->data));
-#else
- comms = simcall_comm_waitany__get__comms(req);
-#endif
-
- for (index = 0; index < comms->used; ++index) {
-#if HAVE_MC
- // Fetch act from MCed memory:
- if (mc_mode == MC_MODE_SERVER) {
- memcpy(&act, buffer + comms->elmsize * index, sizeof(act));
- mc_model_checker->process().read(&temp_synchro, remote(act));
- act = &temp_synchro;
- }
- else
-#endif
- act = xbt_dynar_get_as(comms, index, smx_synchro_t);
- if (act->comm.src_proc && act->comm.dst_proc)
- return true;
- }
- return false;