Windows API expect a timeout in millisecond.
SignaObjectAndWait should properly work with a 0 timeout, so try it.
(avoid an invalid lock and an uninitialized return value).
{
vlc_testcancel ();
- mtime_t total = deadline - mdate ();
- if (total <= 0)
- break;
+ mtime_t total = (deadline - mdate ())/1000;
+ if( total < 0 )
+ total = 0;
+
DWORD delay = (total > 0x7fffffff) ? 0x7fffffff : total;
result = SignalObjectAndWait (*p_mutex, *p_condvar, delay, TRUE);
}