Skip to content

Commit

Permalink
Release CPU when waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
pmandin committed Apr 1, 2005
1 parent fbe4e7c commit ae5d1e7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/timer/mint/SDL_systimer.c
Expand Up @@ -39,8 +39,10 @@ static char rcsid =
#include <string.h>
#include <errno.h>

#include <mint/osbind.h>
#include <mint/cookie.h>
#include <mint/sysvars.h>
#include <mint/osbind.h>
#include <mint/mintbind.h>

#include "SDL_error.h"
#include "SDL_timer.h"
Expand All @@ -52,23 +54,27 @@ static char rcsid =
/* The first ticks value of the application */
static Uint32 start;
static SDL_bool supervisor;
static int mint_present; /* can we use Syield() ? */

void SDL_StartTicks(void)
{
void *oldpile;
unsigned long dummy;

/* Set first ticks value */
oldpile=(void *)Super(0);
start=*((volatile long *)_hz_200);
Super(oldpile);

start *= 5; /* One _hz_200 tic is 5ms */

mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
}

Uint32 SDL_GetTicks (void)
{
Uint32 now;
void *oldpile;
void *oldpile=NULL;

/* Check if we are in supervisor mode
(this is the case when called from SDL_ThreadedTimerCheck,
Expand All @@ -93,6 +99,9 @@ void SDL_Delay (Uint32 ms)

now = SDL_GetTicks();
while ((SDL_GetTicks()-now)<ms){
if (mint_present) {
Syield();
}
}
}

Expand Down

0 comments on commit ae5d1e7

Please sign in to comment.