[vlc-commits] win32: thread: don't call WaitOnAddress if the deadline is reached
Steve Lhomme
git at videolan.org
Mon Aug 17 16:14:29 CEST 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Aug 12 08:45:09 2020 +0200| [c34d0760c0c750f241b7087fbf1c691c4ec5d209] | committer: Steve Lhomme
win32: thread: don't call WaitOnAddress if the deadline is reached
Just return ETIMEDOUT directly.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c34d0760c0c750f241b7087fbf1c691c4ec5d209
---
src/win32/thread.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/win32/thread.c b/src/win32/thread.c
index 77e4b27d4f..255946913c 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -289,8 +289,8 @@ int vlc_atomic_timedwait(void *addr, unsigned val, vlc_tick_t deadline)
delay = deadline - vlc_tick_now();
if (delay < 0)
- ms = 0;
- else if (delay >= VLC_TICK_FROM_MS(LONG_MAX))
+ break; // deadline passed
+ if (delay >= VLC_TICK_FROM_MS(LONG_MAX))
ms = LONG_MAX;
else
ms = MS_FROM_VLC_TICK(delay);
@@ -314,8 +314,8 @@ int vlc_atomic_timedwait_daytime(void *addr, unsigned val, time_t deadline)
delay = deadline - time(NULL);
if (delay < 0)
- ms = 0;
- else if (delay >= (LONG_MAX / 1000))
+ break; // deadline passed
+ if (delay >= (LONG_MAX / 1000))
ms = LONG_MAX;
else
ms = delay * 1000;
More information about the vlc-commits
mailing list