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

Michael Van Canneyt michael at freepascal.org
Sun Oct 9 15:14:54 CEST 2011



On Sun, 9 Oct 2011, Hans-Peter Diettrich wrote:

> Mattias Gaertner schrieb:
>> On Sun, 09 Oct 2011 10:49:31 +0200
>> Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:
>> 
>>> [...]
>>> The LCL is not reentrant. 
>> 
>> Most LCL code is reentrant.
>
> Only within the context of an single thread.
>
> This was acceptable on traditional single-CPU/core machines, but nowadays 
> non-visual components, and also parts of a GUI, should be manageable in 
> different (dedicated) threads.

It's not so on Unix. X-Windows is definitely not thread-safe.

I also have not seen any claims from Microsoft that the GDI controls are thread-safe,
and according to

http://stackoverflow.com/questions/2798812/net-controls-why-arent-all-calls-thread-safe

it is simply not thread safe, some exceptions aside.

The argument put forward there is a sane one: only the programmer can meaningfully 
decide on the granularity of the needed marshalling. A framework never can do that.

Michael.




More information about the Lazarus mailing list