Correct me if I'm wrong, But can't you technically make any code 'thread-safe' by using Critical Sections before doing work. In some code I have seen before a critical section was entered before calling TList.Add Now provided that you don't need a specific order, does this not then make it thread safe?
On Wed, Jun 15, 2011 at 1:32 AM, Michael Schnell <[email protected]> wrote: > On 06/14/2011 04:57 PM, Hans-Peter Diettrich wrote: > >> >> How would you expect a thread-safe version to work? A TList doesn't >> serialize requests, this would have to be added separately. >> >> It does not need to, as "separate-instance-thread safe" means that each > thread handles only it's own instance. > > "Add" only needs to use stack variables and instance variables. Both are > dedicated to the thread and thus don't need a protection (OK it if needs to > allocate memory the heap allocation procedure does need protection > mechanism, but this is provided by the infrastructure anyway. ) > > -Michael > > > -- > ______________________________**_________________ > Lazarus mailing list > [email protected].**freepascal.org<[email protected]> > http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus> >
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
