mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-30 08:01:02 +00:00
Port Sys_Sleep() to SDL
This commit is contained in:
parent
e7482b4957
commit
317e63887c
5 changed files with 10 additions and 33 deletions
|
@ -62,10 +62,6 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
//===========================================================================
|
||||
|
||||
void Sys_Sleep( const int time ) {
|
||||
sleep( time );
|
||||
}
|
||||
|
||||
void EditorPrintConsole( const char *test ) {
|
||||
}
|
||||
|
||||
|
|
|
@ -439,22 +439,6 @@ ID_TIME_T Sys_FileTimeStamp(FILE * fp) {
|
|||
return st.st_mtime;
|
||||
}
|
||||
|
||||
void Sys_Sleep(int msec) {
|
||||
if ( msec < 20 ) {
|
||||
static int last = 0;
|
||||
int now = Sys_Milliseconds();
|
||||
if ( now - last > 1000 ) {
|
||||
Sys_Printf("WARNING: Sys_Sleep - %d < 20 msec is not portable\n", msec);
|
||||
last = now;
|
||||
}
|
||||
// ignore that sleep call, keep going
|
||||
return;
|
||||
}
|
||||
// use nanosleep? keep sleeping if signal interrupt?
|
||||
if (usleep(msec * 1000) == -1)
|
||||
Sys_Printf("usleep: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
char *Sys_GetClipboardData(void) {
|
||||
Sys_Printf( "TODO: Sys_GetClipboardData\n" );
|
||||
return NULL;
|
||||
|
|
|
@ -143,11 +143,8 @@ void Sys_Printf( const char *msg, ... )id_attribute((format(printf,1,2)));
|
|||
void Sys_DebugPrintf( const char *fmt, ... )id_attribute((format(printf,1,2)));
|
||||
void Sys_DebugVPrintf( const char *fmt, va_list arg );
|
||||
|
||||
// a decent minimum sleep time to avoid going below the process scheduler speeds
|
||||
#define SYS_MINSLEEP 20
|
||||
|
||||
// allow game to yield CPU time
|
||||
// NOTE: due to SYS_MINSLEEP this is very bad portability karma, and should be completely removed
|
||||
// NOTE: due to SDL_TIMESLICE this is very bad portability karma, and should be completely removed
|
||||
void Sys_Sleep( int msec );
|
||||
|
||||
// Sys_Milliseconds should only be used for profiling purposes,
|
||||
|
|
|
@ -42,6 +42,15 @@ static bool waiting[MAX_TRIGGER_EVENTS] = { };
|
|||
static xthreadInfo *thread[MAX_THREADS] = { };
|
||||
static size_t thread_count = 0;
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_Sleep
|
||||
==============
|
||||
*/
|
||||
void Sys_Sleep(int msec) {
|
||||
SDL_Delay(msec);
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Sys_InitThreads
|
||||
|
|
|
@ -321,15 +321,6 @@ void Sys_DebugVPrintf( const char *fmt, va_list arg ) {
|
|||
OutputDebugString( msg );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_Sleep
|
||||
==============
|
||||
*/
|
||||
void Sys_Sleep( int msec ) {
|
||||
Sleep( msec );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_ShowWindow
|
||||
|
|
Loading…
Reference in a new issue