[idd] driver: use a timeout instead of an event wait.

Waiting on the events is dangerous as there is a race here where
we may end up stuck as the events need to be auto-reset
This commit is contained in:
Geoffrey McRae 2025-03-30 04:28:49 +00:00
parent b58171c3e1
commit 3b883bf9fe

@ -171,21 +171,17 @@ bool CD3D12Device::HeapTest()
CD3D12CommandQueue * CD3D12Device::GetCopyQueue() CD3D12CommandQueue * CD3D12Device::GetCopyQueue()
{ {
HANDLE waitOn[ARRAYSIZE(m_copyQueue)]; for(int c = 0; c < 100; ++c)
{
for (int i = 0; i < ARRAYSIZE(m_copyQueue); ++i) for (int i = 0; i < ARRAYSIZE(m_copyQueue); ++i)
{ {
auto& queue = m_copyQueue[i]; auto& queue = m_copyQueue[i];
if (queue.IsReady()) if (queue.IsReady())
return &queue; return &queue;
}
waitOn[i] = queue.GetEvent(); Sleep(1);
} }
DEBUG_TRACE("Wait"); DEBUG_ERROR("Failed to get a copy queue");
DWORD ready = WaitForMultipleObjects(ARRAYSIZE(waitOn), waitOn, FALSE, INFINITE);
if (ready < ARRAYSIZE(waitOn))
return &m_copyQueue[ready];
return nullptr; return nullptr;
} }