[Lazarus] *SPAM* Re: How does one add an event to a blocking system?

Michael Schnell mschnell at lumino.de
Thu Oct 22 09:58:39 CEST 2015


On 10/21/2015 05:27 PM, Sven Barth wrote:
>
> CheckSynchronize checks for MainThreadID which is determined 
> independently of CheckSynchronize.
>
I see. I suppose the would-be MainThread is just the thread that is used 
to start the application. That does make sense. For the internal logic 
of the Lazarus application the fact that it calls CheckSynchronize() is 
what makes the difference.

> Better usage of terms: Exceptions are thrown (or raised), events are 
> signaled.
You are right. "thrown" is not a good wording for Events. I mostly read 
"fired" on that behalf.

> CheckSynchronize completely walks the lost before it returns.
Thanks a lot for the correction. This is very important to me (see below).

> > AFAIK the return parameter of CheckSynchronize() does not give any 
> decent result and needs to be ignored.
>
> That is indeed always "false" right now. I should check sometime what 
> it is supposed to return... Probably whether at least one event got 
> executed :/
>

Maybe the original idea was to have CheckSynchronize execute only one 
Event and return TRUE if more events up are to be handled.

With this (not existing) design, I would need to do something like:

procedure TmyApplication.ProcessMessages;
begin
while CheckSynchronize() do (*nothing*) ;
end;

With the current design just

procedure TmyApplication.ProcessMessages;
begin
CheckSynchronize();
end;

would be OK, but the code above would work, as well and maybe should be 
preferred for possible future extension.

-Michael




More information about the Lazarus mailing list