[Lazarus] TFPTimer, Linux

Lukasz Sokol el.es.cr at gmail.com
Fri Jan 17 16:02:09 CET 2014

On 17/01/14 14:56, Antonio Fortuny wrote:
>> DaemonApp works using threads.
>> TFPTimer is not usable in threads other than the main thread.
> Right. So I made my own Timer based on the TFPTimer. Almost the same
> code except that the Synchronize(@EventProc) disapeared in my code
> and the EventProc is called immediately. Another little feature is
> that the high level enable disable sequences do not kill the thread:
> using a TEvent and some lines of cole solves this problem whithout
> requiqring lots of CPU processing time. Even in in the worst case the
> thread will respond within 500 ms Yes, I know, but what if more than
> one thread calls the same procedure ? Well, it is not even protected
> by a critical section because based on a single rule: one Timer one
> procedure, nothing less nothing more. As a consequence I consider
> that the event procedure is part of the Timer object but only
> connected at runtime. In a test GUI application, my timer runs
> perfect in a multi-threaded environment (one timer, one thread
> embedded into an object). My only little disappointment is that the
> timer precision goes from -5 to +5 ms. But this doesn't bother me as
> my timers deal with tens (and more hundreds) of ms. So I consider
> that this little error isn't worth writing of code to get rid of it.
> I don't think that the world will stop turning around itself because
> a lack of 5 ms.
> Antonio;

Hello Antonio,

Do you care (enough) to share ? :) timer code [even if it's just a recipe]
and [minimal] example? Maybe on the wiki ?

>> Michael.

More information about the Lazarus mailing list