[Lazarus] Threads in Lazarus code base

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Sep 15 13:48:12 CEST 2010


On Wed, 15 Sep 2010 14:00:19 +0300
"Juha Manninen (gmail)" <juha.manninen62 at gmail.com> wrote:

> On Wednesday 15 September 2010 12:42:58 Vincent Snijders wrote:
> > By default Lazarus is a single threaded application. Only if a lazarus
> > packages that uses threads is used, the IDE needs to include the
> > cthreads unit. Such packages add -dUseCThreads in their usage options
> > (Open package, Options -> Usage -> Add options to dependent packages
> > and projects -> Custom).
> > 
> > So, no, it is not always needed, until now, only if a third party
> > package requires it. I would think twice about making this change.
> 
> Ok, I will check the OnIde handler solution you suggested in the other mail.
> Then the dialog would appear immediately and the user would propably not 
> notice anything because he typically thinks for a second before clicking 
> anything, and during that time the scanning task is completed already.
> Still, it is not an ideal solution. Sometimes an "experienced converter user" 
> would click a control quickly and then send a bug report about the dialog not 
> responding always.

Show a progress bar.
Enable the button not before it is ready.

 
> I would understand this resistance against threads if there was a technical 
> reason for it. Threads in FPC/Lazarus are working well for me at least.
> Is there some technical reason I don't know about?
> 
> The main trend in programming now is to encourage threading, not to ban it.
> I am little puzzled...

Multi threading is not banned. Just keep in mind that it is a magnitude
harder to maintain and add comments to every method/variable if it
runs in the main thread or a worker thread.


Mattias




More information about the Lazarus mailing list