On Mon, Jun 27, 2011 at 2:51 PM, Hans-Peter Diettrich <drdiettri...@aol.com> wrote: >> Absolutely incorrect. > > Why? >
Two reasons. 1.) Visibility. A critical section does not particularly protect visibility as with 2 threads accessing a piece of memory. 2.) Execution Order. A critical section does not protect or ensure that code will be executed in any particular order. This is where multi-core/multi-threaded systems vs theory get extremely complicated. AMD vs Intel. Kernels Linux vs Windows. The only way to make sure you can get code in proper order with regard to memory assignments ( specifically variables) is to use Interlocked methods. This is why they were designed. The analogy would be like using a wisk vs a commerical grade mixer to scramble your eggs. Use the commercial grade mixer in this case (CriticalSection) and expect a high cost of use and tons of wait states - which translates into poor benchmarks. -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus