1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-10 23:08:07 +00:00

Use a sanity check on timeout on windows.

This commit is contained in:
Con Kolivas 2013-10-27 13:35:47 +11:00
parent 36c6da8ad4
commit b424612cce

6
util.c
View File

@ -1061,9 +1061,13 @@ void cgtimer_time(cgtimer_t *ts_start)
static void liSleep(LARGE_INTEGER *li, int timeout) static void liSleep(LARGE_INTEGER *li, int timeout)
{ {
HANDLE hTimer = CreateWaitableTimer(NULL, TRUE, NULL); HANDLE hTimer;
DWORD ret; DWORD ret;
if (unlikely(timeout <= 0))
return;
hTimer = CreateWaitableTimer(NULL, TRUE, NULL);
if (unlikely(!hTimer)) if (unlikely(!hTimer))
quit(1, "Failed to create hTimer in liSleep"); quit(1, "Failed to create hTimer in liSleep");
ret = SetWaitableTimer(hTimer, li, 0, NULL, NULL, 0); ret = SetWaitableTimer(hTimer, li, 0, NULL, NULL, 0);