[Lazarus] EpikTimer v1.0.1 released
Michael Schnell
mschnell at lumino.de
Mon May 26 11:38:49 CEST 2014
On 05/24/2014 01:55 PM, Graeme Geldenhuys wrote:
>
> I applied some of my changes to code in Github (more changes recently
> discussed in this mailing list will follow soon), fixed the "etdemo"
> project to be compilable again, updated the demo to use FPC Resources
> instead of the old *.lrs files.
Great !
As EpikTimer internals seem to be discussed here rather than in
fc-devel, I add some comments in this thread.
I use EpikTimer in my (soon to be released) work on the ActiveNoGUI
Widget Type.
Here I found, that it is a rather appropriate use for EpikTimer to
handle it in a "static" way, not creating an instance of TEpikTimer with
every use of same, but simply to use class properties, class procedures
and class functions of TEpikTimer.
To allow for this, during the weekend, I modified the (not absolutely
latest) version of epiktimer.pas in a very straight forward manner, just
defining some variables as "class var", and adding "class" to some
properties, procedures and functions.
Moreover I moved the function "InitTimebases" out of the creator and
made it to be a private "class procedure TEpikTimer.InitTimebases;"
Also TEpikTimer.InitTimebases is called in an initialization section of
the EpikTimer unit.
The advantage of this is that the overhead when creating an EpikTimer is
reduced to zero.
The only disadvantage I see is is, that with that modification,
different instances of TEpikTimer don't have their own tuning
parameters, as they are calculated only in the initializing phase of the
application.
Hence deriving siblings of TEpikTimer and overloading the virtual functions
SystemSleep, CalibrateCallOverheads, and CalibrateTickFrequency
does not seem to make sense.
(In fact I am not sure, what happens when deriving siblings of
TEpikTimer, as I am astonished that doing things like "class function
SystemSleep(Milliseconds: Integer):integer; Virtual;" is even possible.
I fail to understand how a virtual class function is supposed to work,
as I understand that without an instance there is no virtual message table.)
Is deriving siblings of TEpikTimer and overloading the virtual functions
SystemSleep, CalibrateCallOverheads, and CalibrateTickFrequency really a
viable feature of EpikTimer ? If yes, I am sure that I can find a way to
combine it with the static usability I introduced.
If you want me to, I of course can provide an appropriately modified
version of epiktimer.pas derived from the version you tell me you
consider stable.
Thanks for listening,
-Michael
More information about the Lazarus
mailing list