d3d12: Handle non-infinite wait timeouts > 49.7 days as infinite
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12268>
This commit is contained in:
parent
accd8326c5
commit
1ab906d17f
|
@ -28,6 +28,9 @@
|
|||
|
||||
#include "util/u_memory.h"
|
||||
|
||||
constexpr uint64_t NsPerMs = 1000000;
|
||||
constexpr uint64_t MaxTimeoutInNs = (uint64_t)UINT_MAX * NsPerMs;
|
||||
|
||||
#ifdef _WIN32
|
||||
static void
|
||||
close_event(HANDLE event, int fd)
|
||||
|
@ -46,7 +49,7 @@ create_event(int *fd)
|
|||
static bool
|
||||
wait_event(HANDLE event, int event_fd, uint64_t timeout_ns)
|
||||
{
|
||||
DWORD timeout_ms = (timeout_ns == PIPE_TIMEOUT_INFINITE) ? INFINITE : timeout_ns / 1000000;
|
||||
DWORD timeout_ms = (timeout_ns == PIPE_TIMEOUT_INFINITE || timeout_ns > MaxTimeoutInNs) ? INFINITE : timeout_ns / NsPerMs;
|
||||
return WaitForSingleObject(event, timeout_ms) == WAIT_OBJECT_0;
|
||||
}
|
||||
#else
|
||||
|
@ -71,7 +74,7 @@ create_event(int *fd)
|
|||
static bool
|
||||
wait_event(HANDLE event, int event_fd, uint64_t timeout_ns)
|
||||
{
|
||||
int timeout_ms = (timeout_ns == PIPE_TIMEOUT_INFINITE) ? -1 : timeout_ns / 1000000;
|
||||
int timeout_ms = (timeout_ns == PIPE_TIMEOUT_INFINITE || timeout_ns > MaxTimeoutInNs) ? -1 : timeout_ns / NsPerMs;
|
||||
return sync_wait(event_fd, timeout_ms) == 0;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue