[Lazarus] thread safe

Michael Schnell mschnell at lumino.de
Tue Jun 14 13:26:07 CEST 2011


On 06/14/2011 12:02 PM, Mattias Gaertner wrote:
> Why do you think so?
Sorry I have been typing much faster than thinking here (again). I had 
meant to be talking about TTlist. :-[ :-[ :-[

So once again:

------------------------------------------------------------------------

(Supposedly) TList.Add is "separate-instance-thread safe" (each thread 
can create an instance and use the "Add" procedure without risking a 
conflict).

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

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

-Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110614/6235283f/attachment-0003.html>


More information about the Lazarus mailing list