Founts lockup

Under win95 if I have a busy wait for the timer interrupt founts will
lock up if I move windows around and open other applications. But if I
take the busy wait out, it doesn’t lock up.
char interrupted;

Uint32 sdlhandler(Uint32 time)
{
interrupted=1;
hc++;
return time;
}
pulseon()
{
if(havepulse) return;
havepulse=1;
SDL_SetTimer(10,sdlhandler);
hc=interrupted=0;
}
pulseoff()
{
if(!havepulse) return;
havepulse=0;
SDL_SetTimer(0,0);

}—
Inside my main loop I’m waiting for a nonzero interrupted:
while(!interrupted);
interrupted=0;

I haven’t locked any surfaces at this point. It is as if the timer stops.
If I take that busy wait out it works fine.

Under linux I use the pause() function to wait for the timer, but there
is no pause() under win32. I’m trying to just sit and wait for the
interrupt to occur, and it’d be nice if I didn’t have to do the busy wait.
But it should still work as is. Only it doesn’t-- it locks up. Any ideas?

Under win95 if I have a busy wait for the timer interrupt founts will
lock up if I move windows around and open other applications. But if I
take the busy wait out, it doesn’t lock up.

Can you describe the lockup a bit more?

Inside my main loop I’m waiting for a nonzero interrupted:
while(!interrupted);
interrupted=0;

Try handling events inside your busy loop:

	while(!interrupted) {
		SDL_Event event;

		if ( SDL_PollEvent(&event) ) ...
	}
	interrupted=0;

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Under win95 if I have a busy wait for the timer interrupt founts will
lock up if I move windows around and open other applications. But if I
take the busy wait out, it doesn’t lock up.

Can you describe the lockup a bit more?

Everything freezes on the founts window. For a while if I move windows
around over the founts window, the founts window contains remnants of
the other window–ie no expose action repainting the founts window contents.
Other apps are working, just founts is locked. I have to hit ctrl-alt-del
then end the founts task. After a while of founts not dealing with expose
events, the system seems to be erasing the window for me–meaning as I move
other windows around their image on the founts window gets erased.

Inside my main loop I’m waiting for a nonzero interrupted:
while(!interrupted);
interrupted=0;

Try handling events inside your busy loop:

  while(!interrupted) {
  	SDL_Event event;

  	if ( SDL_PollEvent(&event) ) ...
  }
  interrupted=0;

I tried this and it doesn’t seem to lock up. I’m calling my scaninput()
routine which calls SDL_PollEvent. Meaning this fixes the problem. Any
idea as to why that fixes it?

Thanks–
Dave

  while(!interrupted) {
  SDL_Event event;

  if ( SDL_PollEvent(&event) ) ...
}
  interrupted=0;

I tried this and it doesn’t seem to lock up. I’m calling my scaninput()
routine which calls SDL_PollEvent. Meaning this fixes the problem. Any
idea as to why that fixes it?

Yup. Windows relies on you handling messages, or your applications plays
possum. :slight_smile:

Many events (like resize and refresh) are handled synchronously with the
application, rather than asynchronously as they are under X11.

The lesson? Always handle events. :slight_smile:

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec