in coinrun/coinrun.cpp [1908:1927]
void vec_step_async_discrete(int handle, int32_t *actions)
{
std::shared_ptr<VectorOfStates> vstate = vstate_find(handle);
QMutexLocker sleeplock(&h2s_mutex);
{
QMutexLocker lock2(&vstate->states_mutex);
for (int e = 0; e < vstate->nenvs; e++) {
std::shared_ptr<State> state = vstate->states[e];
assert((unsigned int)actions[e] < (unsigned int)NUM_ACTIONS);
state->agent.action_dx = DISCRETE_ACTIONS[2 * actions[e] + 0];
state->agent.action_dy = DISCRETE_ACTIONS[2 * actions[e] + 1];
{
QMutexLocker lock3(&state->step_mutex);
state->agent_ready = true;
workers_todo.push_back(state);
}
}
}
wait_for_actions.wakeAll();
}