[fpc-pascal] Is TFPList thread safe?

Michael Schnell mschnell at lumino.de
Thu Oct 2 09:51:58 CEST 2014


On 10/02/2014 03:02 AM, Xiangrong Fang wrote:
> Hi,
>
> I would like to know if TFPList is thread-safe or not? And if I make a 
> component thread-safe by using critical sections etc. Is the 
> performance penalty noticeable?
For a class, Thread save" is not that easily defined.

e.g.:

It can be fully thread save (like TThreadList): you can call any 
function/property at any time from any thread.
It could be allowed to create multiple instances in multiple threads and 
use each of them with it's own thread but not with others (holds for TList)
It could be allowed to crate an instance with one thread and after that 
use functions/properties with a single other one. (e.g.: TList)
it could be allowed to use all instances of the class only in a one and 
only thread.
It could be allowed to be used only in a predefined (e.g. the main-) 
thread (many classes in the LCL).
...

-Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20141002/973120b1/attachment.html>


More information about the fpc-pascal mailing list