FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
time_sleep.c
Go to the documentation of this file.
1
/* sleep() function */
2
3
#include "
fb.h
"
4
5
void
fb_ConsoleSleep
(
int
msecs )
6
{
7
#if defined( HOST_XBOX )
8
/* NOTE: No need to test for input keys because sleep will be hooked
9
* when the application is switched to graphics mode and the
10
* console implementations for keyboard handling are only dummy
11
* functions.
12
*/
13
fb_Delay
( msecs );
14
#else
15
/* infinite? wait until any key is pressed */
16
if
( msecs == -1 ) {
17
while
( !
fb_hConsoleInputBufferChanged
( ) )
18
fb_Delay
( 50 );
19
return
;
20
}
21
22
/* if above n-mili-seconds, check for key input, otherwise,
23
don't screw the precision with slow console checks */
24
if
( msecs >= 100 ) {
25
while
( msecs > 50 ) {
26
if
(
fb_hConsoleInputBufferChanged
( ) )
27
return
;
28
29
fb_Delay
( 50 );
30
msecs -= 50;
31
}
32
}
33
34
if
( msecs >= 0 )
35
fb_Delay
( msecs );
36
#endif
37
}
rtlib
time_sleep.c
Generated on Thu Jan 23 2014 19:40:14 for FreeBASIC by
1.8.4