[Lazarus] thread safe

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Jun 27 19:52:32 CEST 2011


Michael Schnell schrieb:
> On 06/27/2011 04:58 PM, Andrew Brunner wrote:
>> You're totally underestimating the need for a memory barrier :
> While I do know that memory barriers are the way to go to avoid the 
> expensive use of Mutex and friends, I am positive that an MB is not 
> necessary if all accesses to something are protected by a Mutex

You forget the strength of protection. A MB will disallow immediately 
any concurrent access to the memory area - no way around. Protection by 
other means only can work in *perfect* cooperation, a very weak model.

Furthermore a MB still requires management by other means (MUTEX...), to 
prevent deadlocks. Unless the MB will block *any* activity on *all* the 
critical program data at once, what would lead to single-thread 
behaviour of the program.

DoDi





More information about the Lazarus mailing list