another few fixes for the timeing. -usleep isn't that good i've gone back to select

origin
stpohle 23 years ago
parent a43d0cffd6
commit 8b7160d213

@ -135,7 +135,7 @@ gamesrv_getserver ()
ds = 0;
SDL_Flip (gfx.screen);
}
s_delay (250);
s_delay (25);
}

@ -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

Loading…
Cancel
Save