[Lazarus] thread safe

Henry Vermaak henry.vermaak at gmail.com
Tue Jun 28 11:22:01 CEST 2011


On 27/06/11 23:31, Andrew Brunner wrote:
>
> 2.) Execution Order.  A critical section does not protect or ensure
> that code will be executed in any particular order.  This is where

How do you know this?  Unfortunately I can't read the code for the 
Windows critical sections and the documentation doesn't explicitly state 
anything, but at least pthread mutex guarantees a memory barrier.  So if 
you're using the fpc rtl critical sections on unix (which uses 
pthread_mutex), your statement is false.

You'll have to read the generated assembler for Windows critical 
sections.  My hunch would be that they use memory barriers, too.

Henry




More information about the Lazarus mailing list