[Lazarus] thread safe

Michael Schnell mschnell at lumino.de
Tue Jun 14 11:53:14 CEST 2011


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).

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

Simply stating that TThreadList.Add is "not thread save" (which of course is perfectly correct) would prevent using a TThreadList as a data store e.g. in a thread class that itself is instantiated multiple times. There using TThreadList would be overkill.

-Michael





More information about the Lazarus mailing list