nanogui: Timeouts in nano-X


Previous by date: 2 Jan 2001 21:30:17 -0000 Timeouts in nano-X, Amit Kulkarni
Next by date: 2 Jan 2001 21:30:17 -0000 question about using GrArea().., LC. Chang
Previous in thread: 2 Jan 2001 21:30:17 -0000 Timeouts in nano-X, Amit Kulkarni
Next in thread:

Subject: Re: Timeouts in nano-X
From: Alex Holden ####@####.####
Date: 2 Jan 2001 21:30:17 -0000
Message-Id: <Pine.LNX.4.04.10101022112300.612-100000@hyperspace.linuxhacker.org>

On Wed, 3 Jan 2001, Amit Kulkarni wrote:
> When i want to keep timeouts for various windows, or widgets :-) rather then 
> the thing becomes very hard to handle.

It's not very hard. In the next version of Microwindows, the server will
have a generic timer mechanism that I hacked up in a couple of hours
(assuming Greg decides to include it- he was making noises about having
too much stuff to merge the last time I heard from him). It isn't 
accessible to clients, but the same method can easily be implemented in a
widget set. You need a list of timeout events with expiry callbacks and a 
couple of utility functions to add and remove them, and then before you
enter the select (ie. call GrGetNextEventTimeout()), find the shortest
timeout in the list and use that as the select timeout. After the select
returns, handle any non timer events, then go through and call the
callback functions of all the timers which have expired. If you have to
handle more than a few tens of simultaneous timeouts, the events should
either be sorted, or ideally arranged in a heap (see my TEA Total code
for a public domain implementation of one). The server never has more than
two or three simultaneous timeouts though, so I just used a simple linear
search for that.

-- 
------- Alex Holden -------
http://www.linuxhacker.org/
 http://www.robogeeks.org/


Previous by date: 2 Jan 2001 21:30:17 -0000 Timeouts in nano-X, Amit Kulkarni
Next by date: 2 Jan 2001 21:30:17 -0000 question about using GrArea().., LC. Chang
Previous in thread: 2 Jan 2001 21:30:17 -0000 Timeouts in nano-X, Amit Kulkarni
Next in thread:


Powered by ezmlm-browse 0.20.