Re: [AD] Undocumented number of timer functions |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2004-09-05, Peter Wang <tjaden@xxxxxxxxxx> wrote:
> >The documentation doesn't say explicitly how many timer functions
> >a user can register. A small test under linux gives me about
> >1000 timers before install_int returns different than zero.
>
> I think your test is wrong.
Indeed, I forgot that calling install_int on the same function
modifies the time. Yes, I can't go above 16. How about this patch?
> Timer drivers can implement their own install_int, etc. methods
> but I don't think any of them do. In that case they fall back
> on the default implementation in timer.c, which can only hold
> 16 timers (see MAX_TIMERS in aintern.h). Moreover, Allegro can
> use some of these itself (a quick look: mouse cursor drawing,
> keyboard rate handling, MIDI playing, the digital sound sweep
> effect and FLIC playing can all use timer interrupts).
Maybe that should change to MAX_USER_TIMERS and Allegro use
MAX_INTERNAL_TIMERS to be able to guarantee a fixed number?
Index: docs/src/allegro._tx
===================================================================
RCS file: /cvsroot/alleg/allegro/docs/src/allegro._tx,v
retrieving revision 1.253
diff -u -r1.253 allegro._tx
--- docs/src/allegro._tx 3 Sep 2004 11:50:46 -0000 1.253
+++ docs/src/allegro._tx 5 Sep 2004 20:04:01 -0000
@@ -2359,10 +2359,15 @@
@xref install_timer, remove_int, install_int_ex, install_param_int
@eref exscn3d, exswitch, extimer, exzbuf
Installs a user timer handler, with the speed given as the number of
- milliseconds between ticks. This is the same thing as
- install_int_ex(proc, MSEC_TO_TIMER(speed)). If you call this routine
- without having first installed the timer module, install_timer() will be
+ milliseconds between ticks. If the timer is already installed, its speed
+ is adjusted. This is the same thing as
+ install_int_ex(proc, MSEC_TO_TIMER(speed)). If you call this routine
+ without having first installed the timer module, install_timer() will be
called automatically.
+
+ Allegro allows a maximum of 16 timers. However, Allegro may install timers
+ for internal purposes (like MIDI playback), so you shouldn't count on
+ being able to use all of them for yourself.
@retval
Returns zero on success, or a negative number if there is no room to add
a new user timer.
@@ -2429,6 +2434,10 @@
Obviously this can get awkward if you use complicated data structures and
call other functions from within your handler, so you should try to keep
your interrupt routines as simple as possible.
+
+ Allegro allows a maximum of 16 timers. However, Allegro may install timers
+ for internal purposes (like MIDI playback), so you shouldn't count on
+ being able to use all of them for yourself.
@retval
Returns zero on success, or a negative number if there is no room to add
a new user timer.