[Lazarus] Are multiple critical sections allowed in form or data module?

Michael Schnell mschnell at lumino.de
Mon Oct 10 10:11:32 CEST 2011


On 10/09/2011 09:14 AM, Frank Church wrote:
>
>
>
> Do you mean that TCriticalSection is part of the LCL and shouldn't be 
> run from within a thread, or that code within the thread or the 
> critical section must not run code accessing the LCL?
TCriticalSection is obviously done to be used in Thread.
>
> How is it determined whether a piece of code runs within the LCL or not?
The documentation on this is rather poor. (E.g. the "Thread-Safety" of 
Tlist has recently been discussed.)

In fact the help for any LCL and RTL function should say how it can be 
used regarding threads.

It is known that any function that accesses the GUI can only be called 
by the main thread. You might get a runtime error when violating this 
rule, but there is no purposeful assertion at runtime.

-Michael




More information about the Lazarus mailing list