[Lazarus] Threads in Lazarus code base

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


On Wed, 15 Sep 2010 11:45:41 +0200
Vincent Snijders <vincent.snijders at gmail.com> wrote:

> 2010/9/15 Juha Manninen (gmail) <juha.manninen62 at gmail.com>:
> > What would you suggest? How to commit the code so that we don't get complaints
> > about RunErrors?
> 
> I suggest:
> Don't use threads, but take a look at the code browser, how to quickly
> show a dialog, while information is still being gathered. I think it
> uses an OnIde handler.

Yes. You can even change the search fields and the search will adapt
while you type. This is done by splitting the search into small steps.
A multi threaded implementation would do the same, but you would need
some extra thread control (e.g. critical sections) and all other IDE
code accessing the structures must be adapted too. OTOH a multi
threaded might start several threads which might be faster, although
the speed is mainly limited by disk and memory throughput, not so much
by cpu. A big time (two seconds) is spent in putting the 200.000 nodes
into a TTreeView. This can not be multi threaded. TTreeView needs some
optimizations to not compute all the text widths every time.

Mattias




More information about the Lazarus mailing list