ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/win_usleep.c
Revision: 3.1
Committed: Tue Mar 20 22:45:29 2018 UTC (6 years, 1 month ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad5R3, HEAD
Log Message:
Created replacement usleep() function for Windows

File Contents

# User Rev Content
1 greg 3.1 #ifndef lint
2     static const char RCSid[] = "$Id$";
3     #endif
4     /*
5     * Windows replacement usleep() function.
6     */
7    
8     #include "platform.h"
9    
10     int
11     usleep(__int64 usec)
12     {
13     HANDLE timer;
14     LARGE_INTEGER ft;
15    
16     // Convert to 100 nanosecond interval, negative value indicates relative time
17     ft.QuadPart = -(10*usec);
18    
19     timer = CreateWaitableTimer(NULL, TRUE, NULL);
20     SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0);
21     WaitForSingleObject(timer, INFINITE);
22     CloseHandle(timer);
23     return(0);
24     }