Commit 67216f1c authored by jdelange's avatar jdelange

* po_hi_time.c

   - Support for the delay_until function on Win32



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@4657 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent a1ebaca5
......@@ -220,6 +220,34 @@ int __po_hi_delay_until (const __po_hi_time_t* time)
return (__PO_HI_ERROR_PTHREAD_COND);
}
return (__PO_HI_SUCCESS);
#elif defined (_WIN32)
HANDLE hTimer = NULL;
LARGE_INTEGER ularge;
hTimer = CreateWaitableTimer(NULL, TRUE, NULL);
ularge = __po_hi_unix_seconds_to_windows_tick (time->sec, time->nsec);
if (!SetWaitableTimer(hTimer, &ularge, 0, NULL, NULL, 0))
{
__PO_HI_DEBUG_DEBUG("[DELAY UNTIL] SetWaitableTimer failed (%d)\n", GetLastError());
return 2;
}
if (WaitForSingleObject(hTimer, INFINITE) != WAIT_OBJECT_0)
{
__PO_HI_DEBUG_DEBUG("[DELAY UNTIL] WaitForSingleObject failed (%d)\n", GetLastError());
}
if (CloseHandle(hTimer) != TRUE)
{
__PO_HI_DEBUG_DEBUG("[DELAY UNTIL] CloseHandle failed (%d)\n", GetLastError());
}
printf ("wait completed\n");
return __PO_HI_SUCCESS;
#else
return (__PO_HI_UNAVAILABLE);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment