Am 05.11.2006 um 12:14 schrieb Colin Western:
Amir Aavani wrote:
InitCriticalSection (cs);
while true do
begin
EnterCriticalsection (cs);
WriteLn ('Here!');
end;
LeaveCriticalsection (cs);
Each Enter.. must be matched by a Leave..., and you don't need the
loop. The standard way of doing this is:
I'm sure that this is clear for Amir. But in his example he (and me
too) expects that the loop should stop at the second time it calls
EnterCriticalsection() because the old critical section wasn't left.
EnterCriticalsection (cs);
try
WriteLn ('Here!');
finally
LeaveCriticalsection (cs);
end;
But this is not an example to show how a critical section stops
another one.
Regards
Michael
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel