[SDL] Re: Using separate threads...

Santiago Romero nop at todolinux.org
Sun Apr 30 02:07:55 PDT 2000

El 28 Apr 2000 04:04:10 GMT, Stephane Peter escribió:

>>  Hi! I'm using a separate thread and into it I do something like:
>>  [...]
>>  I've tested SDL_SetTimer() but the emulator hangs sometimes!!!
>>  It starts working, but something crashes (and sometimes not :),
>>  and this thread-style works always...
>That depends if you're doing some timer stuff from within your timer
>handler, although the latest 1.1 version of SDL from CVS should be
>safe in that respect. Just make sure you use the SDL threaded timers
>and not the alarm() based ones that don't work properly in multithreaded
>programs (call SDL_Init() with the SDL_INIT_EVENTTHREAD flag additionnally
>Are you using SDL 1.0 or 1.1 ? 

 1.0.8 I'm using it because is supposed being better to use the stable
 version O:-) Well... I'll tell you what I'm trying to do to see what 
 you advice me.

 Imagine an emulator, something like:

 int Z80Run(Numcycles)
        #include "big_switch.c"

 Then in the mainloop I have something like:

    case 0: Z80Run(224);
            while(!timerwait) ;

 And the timerwait is controlled by:

 Uint32 threadfunc( void * )

 Do you think I should use timers or theads for the above? Is just for
 syncronise each scanline with the 50Hz timer, so that only an emulated
 screen scanline is drawn at each 1/50 s.

 thx a lot.

> "Microsoft has done to computers what McDonald's has done to gastronomy"

 hehehe I'll add it to my RANDSIG for Linux :)

To hear the voice of God, type cat vmlinuz >/dev/audio

|  NoP / Compiler          --       nop @ todolinux.org |
|  POWERED BY - Linux RedHat 6.0  -  Reg. User #74.821  |
|             http://www.ctv.es/USERS/sromero           |

More information about the SDL mailing list