[Lazarus] Threads in Lazarus code base

Florian Klaempfl florian at freepascal.org
Fri Sep 17 13:42:15 CEST 2010

Am 17.09.2010 13:33, schrieb Michael Schnell:
>  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.

This is imo the real challenging part, besides mechanisms to abort
threads. Especially because using the current mechanisms of
synchronication, it is very hard to read multithreaded programs.

More information about the Lazarus mailing list