[Lazarus] thread safe

Henry Vermaak henry.vermaak at gmail.com
Tue Jun 28 12:13:42 CEST 2011


On 27/06/11 23:31, Andrew Brunner wrote:
>   AMD vs Intel.  Kernels Linux vs Windows.  The only way to make sure

How does the kernel matter?

Other than the cpu, compilers can also reorder instructions.  You can 
use __asm__ __volatile__("": : :"memory") in c to stop gcc from screwing 
around with the order, for example.  This is of course if a hardware 
memory barrier isn't necessary.

> 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.

No.  You have to use memory barriers for this.  Atomic operations are 
only useful for single data elements.

Read Paul McKenney's excellent book:

http://kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html

Henry




More information about the Lazarus mailing list