Re: [AD] Timer interrupts and drawing

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sun, Aug 24, 2008 at 11:41 PM, Thomas Fjellstrom <tfjellstrom@xxxxxxxxxx> wrote:
> On Monday 25 August 2008, Colin Ward wrote:
>> I have a game here that is crashing and when I investigated it, it is
>> installing a timer with install_int() and in that timer's callback it is
>> calling drawing routines to draw things according to the mouse's current
>> position.
>>
>> According to the documentation for install_int() you should consider that
>> you are being called from an interrupt context, so am I correct in thinking
>> that calling drawing routines from a timer callback is NOT allowed?
>
> Pretty much. In Windows and X, timers all run from a (single) separate thread,
> and in DOS, it all runs from an interrupt. Doing anything to complex global
> data is bad, and doing more than a few basic instructions is also bad.
>
>> --
>> /-------------------------------------------------------------------\
>> [Hitman/Code HQ - 6502/z80/68000/604e/80x86/ARM coder - Amiga rulez!]
>> [VZ-200/VIC-20/MZ-700/c16/c64*10/c128*8/Plus-4/CPC464/CD32/500*2    ]
>> [600/1000/1200*2/A4000/SNES/N64/Dreamcast/Athlon 1100/AmigaOne      ]
>> [Assembly Language: The most fun you can have with your clothes on! ]
>> \-------------------------------------------------------------------/
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge Build the coolest Linux based applications with Moblin SDK & win
>> great prizes Grand prize is a trip for two to an Open Source event anywhere
>> in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> --
> Thomas Fjellstrom
> tfjellstrom@xxxxxxxxxx
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> --
> https://lists.sourceforge.net/lists/listinfo/alleg-developers
>

Given a lot of that data is stored in thread-local-storage, you can't
really use a timer callback. I do encourage using the event-loop
though. It's response latency is actually quite good anyways.

--ryan




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/