[Lazarus] Can I be sure that timer and synchronize never fire at once?
Mattias Gaertner
nc-gaertnma at netcologne.de
Wed Jan 26 13:08:05 CET 2011
On Wed, 26 Jan 2011 12:58:58 +0100
Michael Schnell <mschnell at lumino.de> wrote:
> On 01/26/2011 11:22 AM, Luca Olivetti wrote:
> >
> > My application (as almost any application I write) is based on the
> > assumption that methods invoked by a timer and methods invoked by a
> > thread with synchronize will never fire at once (i.e. they will be
> > serialized by the main loop).
> >
> > Can I be 100% sure of that?
> Yep.
>
> If the LCL would not do this this would be a bug. Timer events,
> synchronized events, "procedure ... message" Events fired by
> "PostMessage()" in a thread and Events fired by
> Application.QueueAsyncCall are to be serialized and handled in the main
> thread and thus don't preempt the usual handlers that are fired by
> normal GUI events.
>
> I did encounter other bugs with synchronize etc, but not a bug that
> results in handling an event in another thread.
For completeness:
If the main thread calls Synchronize then the method will be called
instantly.
Mattias
More information about the Lazarus
mailing list