[Lazarus] Threads in Lazarus code base
Michael Schnell
mschnell at lumino.de
Fri Sep 17 13:33:10 CEST 2010
On 09/17/2010 11:48 AM, Juha Manninen (gmail) wrote:
> On Friday 17 September 2010 11:47:12 Florian Klaempfl wrote:
>> Same can be said about goto and labels. Very intuitive and simple why
>> bother about while, for, repeat loops?
> Well, it is a valid comparison. I remember reading about new syntax in some
> languages. One is a "future variable" which you calculate in one place and
> then use later. Actually the compiler creates a thread for the calculation and
> does "waitfor" when the result is used first time. Cool!
>
> Another was the "parallel" keyword for loops. Cool as well!
>
>
Since long I am raving about "Thread Events". (You might find some posts
about this in the backlog of this list.)
Those are supposed to be procedural properties of objects. Currently
those simply are called. When used as "Events", the Object calls them
when appropriate and they are assigned to procedures by some code
outside of the object. Thus they are used as "Callbacks".
This concept can be enhanced by assigning a thread to such an event with
any call of same and execute the called procedure as this thread. Of
course the function results and var parameters of such a beast would
automatically be "futures"
This would make threads easy to create and use for the programmer, but
of course it would not at all handle the potential complexity problems
regarding mutual access, indeterminated code sequencing, and debugging.
-Michael
More information about the Lazarus
mailing list