[Lazarus] parallel loop: was Threads in Lazarus code base

Florian Klaempfl florian at freepascal.org
Wed Sep 15 16:38:09 CEST 2010


Am 15.09.2010 16:09, schrieb Mattias Gärtner:
> Zitat von Florian Klaempfl <florian at freepascal.org>:
> 
>> Am 15.09.2010 15:26, schrieb ik:
>>>
>>>
>>> On Wed, Sep 15, 2010 at 15:16, Florian Klaempfl <florian at freepascal.org
>>> <mailto:florian at freepascal.org>> wrote:
>>>
>>>     Am 15.09.2010 13:56, schrieb Michael Schnell:
>>>     > My impression is that regarding the OS-interface of a program that
>>>     needs
>>>     > the said features (multiple "logical threads", performance,
>>> latency,
>>>     > making use of modern SMP systems, ...), threads are a
>>> necessity. But
>>>     > programming languages might be able to in many cases hide the
>>> dirty
>>>     > details from the programmer (e.g. "parallel" loops, see the Delphi
>>>     Prism
>>>     > and/or .NET documentation on these issues.) If FPC could be
>>>     enhances tn
>>>     > that direction it might be a decent improvement.
>>>
>>>     The parallel loop solves nothing which makes threading hard and
>>> is only
>>>     a cheap excuse. The real problems of threading are
>>> synchronization and
>>>     especially abording threads e.g. triggered by the main thread.
>>>
>>>
>>> So how do you do multiple sub routines "at the same time", or some tasks
>>> that will hang your system but you require it to function even when it
>>> does the heavy work ?
>>
>> It depends on the application. But as I said before: aborting something
>> like a parallel loop because the user pressed e.g. ESC isn't easy either.
> 
> It's not that hard either.

Well, it depends how much resources must be freed, how "snappy" the
abording should be etc. If the parallel threads need also locking, it
gets ugly imo.




More information about the Lazarus mailing list