[Lazarus] Lazarus application crash. Is PostMessage thread safe?

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Feb 12 15:17:57 CET 2016


On Fri, 12 Feb 2016 14:53:29 +0100
Michael Schnell <mschnell at lumino.de> wrote:

> On 02/10/2016 10:12 PM, C Western wrote:
> >
> > My understanding is Application.ProcessMessages has to be reentrant ...
> 
> As calling Application.ProcessMessages is only allowed from the main 
> thread it does not need to be reentrant = thread-save.

IMHO, Michael, you should not redefine words. It confuses people.
Reentrant means it can be called again, while it is still running. It
does not need to be thread-safe. And a thread-safe function does not
need to be reentrant.
Application.ProcessMessages itself is reentrant, but it is not
thread-safe. In fact, as already noted by Michael, it must only be
called by the main thread.
But Application.ProcessMessages can call almost any event
handler, which might not support changing certain properties while
executing.

 
> Of course it can be called recursively and it hence is reentrant in that 
> meaning.

True.

Mattias




More information about the Lazarus mailing list