Yep. Acquire() will only block access by another thread. When the recursive
thread call its final Release() the other thread will be allowed to
continue.

----- Original Message ----- 
From: "Allan, Samuel" <[EMAIL PROTECTED]>
To: "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]>
Sent: Thursday, February 12, 2004 4:50 PM
Subject: [DUG] TCriticalSection


> Quick question, I think I'm right, but I just want confirmation:
>
> If a thread calls Aquire a second time on the same TCriticalSection,
> then the thread does not block right?
>
> The thread does not release the TCriticalSection until all calls to
> Aquire have been matched by a call to Release?
>
> I have a recursive method that needs to be locked away behind a
> TCriticalSection. Like I can rewrite so there's no problem, but this is
> easier.
>
> procedure RecursiveMethod;
> begin
>   criticalSection.Aquire;
>   try
>     ...
>     RecursiveMethod;
>     ...
>   finally
>     critcalSection.Release;
>   end;
> end;
>
> _______________________________________________
> Delphi mailing list
> [EMAIL PROTECTED]
> http://ns3.123.co.nz/mailman/listinfo/delphi
>


_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to