[fpc-pascal] Timer in X11
Henry Vermaak
henry.vermaak at gmail.com
Wed Dec 21 17:39:09 CET 2011
On 21/12/11 16:11, Martin Schreiber wrote:
> On 12/21/2011 04:53 PM, Henry Vermaak wrote:
>> On 21/12/11 14:53, Felipe Monteiro de Carvalho wrote:
>>> wow, I started taking a look at how to do it and as always with
>>> anything related to X11 it is terribly complicated ... but luckly I am
>>> not alone here using FPC, so I shamelessly stole code from fpgui,
>>> hammered it a little bit to fit TTimer and TCDTimer and already have a
>>> initial TTimer for X11. If anyone wants to know how I did:
>>>
>>> http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=rev&root=lazarus&revision=34350
>>>
>>
>> Spinning like this is bad news for efficiency and battery life of
>> embedded devices.
>>
> MSEgui has another method with a list of timer events.
> http://gitorious.org/mseide-msegui/mseide-msegui/blobs/master/lib/common/kernel/msetimer.pas
> On Linux it uses timer signals to build the time steps with microseconds
> resolution.
If I was just interested in linux, I'd probably use timerfd, which would
tie in nicely with the select(). For non-linux, using posix timers and
self-pipe trick with pselect() would also work, but would be more work.
Henry
More information about the fpc-pascal
mailing list