[Lazarus] thread safe

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Jun 28 12:44:16 CEST 2011


Andrew Brunner schrieb:
> On Mon, Jun 27, 2011 at 2:51 PM, Hans-Peter Diettrich
> <DrDiettrich1 at 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.

This is exactly what I wanted to say. A critical section does *not* 
enforce a MB (by visibility).

> 2.) Execution Order.  A critical section does not protect or ensure
> that code will be executed in any particular order.

Right. When execution order (race conditions) is of interest, it must be 
established by other means. Here is where deadlocks enter the scene.

I think that you didn't understand what I wanted to say. Hard to tell, 
due to the snipped details you are referring to :-(

DoDi





More information about the Lazarus mailing list