- mc_procstate_t procstate = &state->proc_status[process->pid];
-
- if (procstate->state != MC_INTERLEAVE
- && procstate->state != MC_MORE_INTERLEAVE)
- return NULL;
- if (!MC_process_is_enabled(process))
- return NULL;
-
- switch (process->simcall.call) {
-
- case SIMCALL_COMM_WAITANY:
- *value = -1;
- while (procstate->interleave_count <
- read_length(mc_model_checker->process(),
- remote(simcall_comm_waitany__get__comms(&process->simcall)))) {
- if (MC_request_is_enabled_by_idx
- (&process->simcall, procstate->interleave_count++)) {
- *value = procstate->interleave_count - 1;
- break;
- }
- }
-
- if (procstate->interleave_count >=
- simgrid::mc::read_length(mc_model_checker->process(),
- simgrid::mc::remote(simcall_comm_waitany__get__comms(&process->simcall))))
- procstate->state = MC_DONE;
-
- if (*value != -1)
- return &process->simcall;
-
- break;
-
- case SIMCALL_COMM_TESTANY: {
- unsigned start_count = procstate->interleave_count;
- *value = -1;
- while (procstate->interleave_count <
- read_length(mc_model_checker->process(),
- remote(simcall_comm_testany__get__comms(&process->simcall)))) {
- if (MC_request_is_enabled_by_idx
- (&process->simcall, procstate->interleave_count++)) {
- *value = procstate->interleave_count - 1;
- break;
- }
- }
-
- if (procstate->interleave_count >=
- read_length(mc_model_checker->process(),
- remote(simcall_comm_testany__get__comms(&process->simcall))))
- procstate->state = MC_DONE;
-
- if (*value != -1 || start_count == 0)
- return &process->simcall;
-
- break;
- }
-
- case SIMCALL_COMM_WAIT: {
- smx_synchro_t remote_act = simcall_comm_wait__get__comm(&process->simcall);
- s_smx_synchro_t act;
- mc_model_checker->process().read_bytes(
- &act, sizeof(act), remote(remote_act));
- if (act.comm.src_proc && act.comm.dst_proc) {
- *value = 0;
- } else {
- if (act.comm.src_proc == NULL && act.comm.type == SIMIX_COMM_READY
- && act.comm.detached == 1)
- *value = 0;
- else
- *value = -1;
- }
- procstate->state = MC_DONE;
- return &process->simcall;
- }
-
- case SIMCALL_MC_RANDOM:
- if (procstate->state == MC_INTERLEAVE)
- *value = simcall_mc_random__get__min(&process->simcall);
- else {
- if (state->req_num < simcall_mc_random__get__max(&process->simcall))
- *value = state->req_num + 1;
- }
- procstate->state = MC_DONE;
- return &process->simcall;
-
- default:
- procstate->state = MC_DONE;
- *value = 0;
- return &process->simcall;
- }
- return NULL;
-}
-
-smx_simcall_t MC_state_get_request(mc_state_t state, int *value)
-{
- smx_process_t process = NULL;
- MC_EACH_SIMIX_PROCESS(process,
- smx_simcall_t res = MC_state_get_request_for_process(state, value, process);