On 02 Oct 2014, at 15:59, Xiangrong Fang wrote:

I think the only thread-critical operation I need is to add item to the
list, so I will use critical section myself, not replace TFPList with
TThreadList, for simplicity and performance reason...

It will make your program unstable (adding an element to an fplist can cause the entire internal array to move, so if you are in the middle of a read operation at the same time, that read operation will either read invalid data or crash). Unless you are an expert at multithreaded programming, don't try to optimise existing thread-safe structures (and definitely don't perform premature optimisations).


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to