From 8b7160d213701eed35f7fb23b4ec80490971c641 Mon Sep 17 00:00:00 2001 From: stpohle Date: Wed, 7 May 2003 23:57:19 +0000 Subject: [PATCH] another few fixes for the timeing. -usleep isn't that good i've gone back to select --- src/gamesrv.c | 2 +- src/sysfunc.c | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/gamesrv.c b/src/gamesrv.c index e5f11d6..f58c42b 100644 --- a/src/gamesrv.c +++ b/src/gamesrv.c @@ -135,7 +135,7 @@ gamesrv_getserver () ds = 0; SDL_Flip (gfx.screen); } - s_delay (250); + s_delay (25); } diff --git a/src/sysfunc.c b/src/sysfunc.c index 07e10e5..2f8f057 100644 --- a/src/sysfunc.c +++ b/src/sysfunc.c @@ -1,4 +1,4 @@ -/* $Id: sysfunc.c,v 1.11 2003/05/07 20:19:20 stpohle Exp $ +/* $Id: sysfunc.c,v 1.12 2003/05/07 23:57:19 stpohle Exp $ sysfunc.c - this file hold some routines for the system functions.. like d_delay */ @@ -6,23 +6,19 @@ #include "bomberclone.h" #include "sysfunc.h" +/* i have no banned usleep completly, even usleep would + bring the cpu usage more down. but i found out that + usleep is not as excact as select is. */ void s_delay (int ms) { fd_set selectset; struct timeval tval; -#ifndef _WIN32 - if (ms < 20) { -#endif - FD_ZERO (&selectset); - tval.tv_sec = 0; - tval.tv_usec = ms * 1000; - select (1, &selectset, NULL, NULL, &tval); -#ifndef _WIN32 - } - else usleep (1000 * ms); -#endif + FD_ZERO (&selectset); + tval.tv_sec = 0; + tval.tv_usec = ms * 1000; + select (1, &selectset, NULL, NULL, &tval); }; int