The idle loop issue


Subject: The idle loop issue
From: Dom Lachowicz (dominicl@seas.upenn.edu)
Date: Thu Sep 06 2001 - 10:31:27 CDT


Hi,

This is mainly directed at Martin but I'd appreciate everyone's input on the
topic.

It's ok if we want to add an idle-loop functionality to abiword. However, an
idle is most certainly not a timer, and should not be contained inside of a
UT_Timer class, though it might share some similar code (interface) with
Timers. This should be split into some abstract base-class or interface which
these 2 classes should share. Here are my requirements:

1) Separate UT_Timer and UT_Idle classes
2) Shared base class/interface between UT_Timer and UT_Idle
3) This "just works", or else we can conditionally fallback to using timers.

Class heirarchy:

    UT_Worker
        |
      -----
     | |
UT_Timer UT_Idle

These classes should share *only* a selective interface, and *NO*
implementation. This will probably mean that we need to restructure our timers
a bit, but that shouldn't be too bad.

Then we can use this later in our code:

#ifdef USING_IDLES
UT_Worker * checker = new UT_Idle ();
#else // USING_TIMERS
UT_Worker * checker = new UT_Timer (SPELLCHECK_MILLISECONDS);
#endif

checker->setCallback (this::spellCheckWord);
checker->setInstanceData (static_cast<void *>(this));
checker->start ();

I'll try to cook up something shortly. Also note that using this UT_Idle class
might be useful in the GTK+/GNOME port inside of the GR_UnixGraphics class to
queue repaints during idle cycles.

Dom



This archive was generated by hypermail 2b25 : Thu Sep 06 2001 - 10:31:29 CDT