[Lazarus] thread safe

Henry Vermaak henry.vermaak at gmail.com
Tue Jun 14 12:12:02 CEST 2011


On 14/06/11 10:53, Michael Schnell wrote:
> On 06/10/2011 06:09 PM, Mattias Gaertner wrote:
>>
>> Sigh. It already does. See my TThreadList.Add example.
> This example shows that it does not make sense.
>
> (Supposedly) TThreadList.Add is "separate-instance-thread safe" (each
> thread can create an instance and use the "Add" procedure without
> risking a conflict).

Everything is "separate-instance-thread safe".  How can something be 
unsafe if only one thread is accessing it?

> TThreadList.Add is not "cross-instance-thread safe" (multiple threads
> using the same instance's "Add" procedure will result in erroneous
> behavior).

No, it won't.  All the operations lock the list, so you can use the same 
instance from multiple threads.  Just read the source before you make 
misguided comments like this.

Henry




More information about the Lazarus mailing list