[Lazarus] thread safe

Michael Schnell mschnell at lumino.de
Tue Jun 28 16:47:57 CEST 2011


On 06/28/2011 05:33 PM, Hans-Peter Diettrich wrote:
>
>
> A critical section (process-local MUTEX) is not related to a specific 
> (memory) resource, except itself, consequently it can not protect any 
> *other* resource. It also does not block any other thread, not waiting 
> for entering the critical section, so that all resources are 
> accessible by all threads, except the critical section (or mutex...) 
> itself.
I understand that you are supposed to do

  CriticalSection.Enter;
    do something with the variables that are protected
  CriticalSection.leave;

What did you think how to use them ? Of course a MUTEX can do other 
things, too, but here we are discussing "normal" CriticalSection use.
-Michael





More information about the Lazarus mailing list