- simgrid::mc::ProcessState* procstate = &state->processStates[process->pid];
- state->transition.pid = -1;
- state->transition.argument = -1;
-
- if (!procstate->isToInterleave())
- return nullptr;
- if (!simgrid::mc::process_is_enabled(process))
- return nullptr;
-
- smx_simcall_t req = nullptr;
- switch (process->simcall.call) {
- case SIMCALL_COMM_WAITANY:
- state->transition.argument = -1;
- while (procstate->interleave_count <
- read_length(mc_model_checker->process(),
- remote(simcall_comm_waitany__get__comms(&process->simcall)))) {
- if (simgrid::mc::request_is_enabled_by_idx(&process->simcall,
- procstate->interleave_count++)) {
- state->transition.argument = 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->setDone();
- if (state->transition.argument != -1)
- req = &process->simcall;
- break;
-
- case SIMCALL_COMM_TESTANY: {
- unsigned start_count = procstate->interleave_count;
- state->transition.argument = -1;
- while (procstate->interleave_count <
- simcall_comm_testany__get__count(&process->simcall))
- if (simgrid::mc::request_is_enabled_by_idx(&process->simcall,
- procstate->interleave_count++)) {
- state->transition.argument = procstate->interleave_count - 1;
- break;
- }
-
- if (procstate->interleave_count >=
- simcall_comm_testany__get__count(&process->simcall))
- procstate->setDone();
-
- if (state->transition.argument != -1 || start_count == 0)
- req = &process->simcall;
-
- break;
- }
-
- case SIMCALL_COMM_WAIT: {
- simgrid::mc::RemotePtr<simgrid::kernel::activity::Comm> remote_act = remote(
- static_cast<simgrid::kernel::activity::Comm*>(simcall_comm_wait__get__comm(&process->simcall)));
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_act;
- mc_model_checker->process().read(temp_act, remote_act);
- simgrid::kernel::activity::Comm* act = temp_act.getBuffer();
- if (act->src_proc && act->dst_proc)
- state->transition.argument = 0;
- else if (act->src_proc == nullptr && act->type == SIMIX_COMM_READY
- && act->detached == 1)
- state->transition.argument = 0;
- else
- state->transition.argument = -1;
- procstate->setDone();
- req = &process->simcall;
- break;
- }
-
- case SIMCALL_MC_RANDOM: {
- int min_value = simcall_mc_random__get__min(&process->simcall);
- state->transition.argument = procstate->interleave_count + min_value;
- procstate->interleave_count++;
- if (state->transition.argument == simcall_mc_random__get__max(&process->simcall))
- procstate->setDone();
- req = &process->simcall;
- break;
- }
-
- default:
- procstate->setDone();
- state->transition.argument = 0;
- req = &process->simcall;
- break;