Re: [AD] Timer interrupts and drawing

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


On 25/08/2008, you wrote:
> 
>> > On Monday 25 August 2008, Colin Ward wrote:
>> >> I have a game here that is crashing and when I investigated it, it
>> >>  is nstalling a timer with install_int() and in that timer's
>> >>  callback it is alling drawing routines to draw things according to
>> >>  the mouse's current osition.
>> >>
>> >> According to the documentation for install_int() you should
>> >>  consider hat you are being called from an interrupt context, so am
>> >>  I correct in hinking that calling drawing routines from a timer
>> >>  callback is NOT llowed?
>> >
>> > Pretty much. In Windows and X, timers all run from a (single)
>> >  separate hread, and in DOS, it all runs from an interrupt. Doing
>> >  anything to omplex global data is bad, and doing more than a few
>> >  basic instructions s also bad.
> 
> I don't think he's using 4.9 yet. could be wrong though.

No, I'm still on 4.2 (and soon 4.3).  When that is released I'll look into
4.9 support.

This problematic code was found in a 3rd party game that my programming
partner ported (I port Allegro, he ports the games) so I'll just have to
tell him that the game itself is broken because it is doing lots of
rendering in a timer callback.  I suppose on Windows/Linux and other
platforms it just works out of luck.

Interestingly though, I would expect timer based rendering to crash in OS
routines called by graphics.c but it is actually crashing in src/mouse.c. 
It might be worth me doing some more research into this.  One thing about
porting these not so well written games is that they do expose deficiencies
in a port's implementation that you might not notice with a game that
"follows the rules."

-- 
/-------------------------------------------------------------------\
[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! ]
\-------------------------------------------------------------------/





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