Windows: add usleep() to roken
Add a version of usleep() which is capable of sleeping in one millisecond increments instead of microseconds. Change-Id: I173f7e6f91a947cdb66f7cc6df5520e1c03f10b7
This commit is contained in:
@@ -969,6 +969,9 @@ gai_strerror(int);
|
||||
ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL
|
||||
sleep(unsigned int seconds);
|
||||
|
||||
ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL
|
||||
usleep(unsigned int useconds);
|
||||
|
||||
#endif
|
||||
|
||||
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/***********************************************************************
|
||||
* Copyright (c) 2009, Secure Endpoints Inc.
|
||||
* Copyright (c) 2009, 2014, Secure Endpoints Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,6 +40,16 @@
|
||||
ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL
|
||||
sleep(unsigned int seconds)
|
||||
{
|
||||
SleepEx(1000 * (DWORD) seconds, FALSE);
|
||||
if (SleepEx(1000 * (DWORD) seconds, FALSE) != 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We can only sleep in millisecond increments */
|
||||
ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL
|
||||
usleep(unsigned int useconds)
|
||||
{
|
||||
if (SleepEx((DWORD)(useconds / 1000), FALSE) != 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user