[Lazarus] thread safe

Henry Vermaak henry.vermaak at gmail.com
Tue Jun 28 16:46:24 CEST 2011


On 28/06/11 15:47, Hans-Peter Diettrich wrote:
> Henry Vermaak schrieb:
>
>
>> You'll have to read the generated assembler for Windows critical
>> sections. My hunch would be that they use memory barriers, too.
>
>  >>
> When a critical section object is owned, the only other threads affected
> are the threads that are waiting for ownership in a call to
> EnterCriticalSection. Threads that are not waiting are free to continue
> running.
> <<
>
> I don't see anything like memory barriers here.

Quoting from 
http://msdn.microsoft.com/en-us/library/ms686355%28v=VS.85%29.aspx

The following synchronization functions use the appropriate barriers to 
ensure memory ordering:

     Functions that enter or leave critical sections
     Functions that signal synchronization objects
     Wait functions
     Interlocked functions

Henry




More information about the Lazarus mailing list