[fpc-pascal] Semaphore problems
Burkhard Carstens
fpc at bcsoft.de
Tue Jul 25 11:11:36 CEST 2006
[...]
coffee, pencil and stuff ;-)
off course, the local procedure "internalEnter" in Leave is a
copy'n'paste rubbish. Just remove ..
TCriticalSection.Leave;
begin
internal.lock;
try
if OwnerThread <> GetCurrentThreadID then begin //we are not
// allowed to leave, because we don't own it!
raise exception.create('leave on a foreign critical section');
end
else begin //we are the owner
if fLockCount = 0 then begin
raise exception.create('leave on a unlocked section');
end
else begin
dec(fLockCount);
if fLockCount=0 then rtlSetEvent(fExternalLock);
end;
end;
finally
internal.unlock;
end;
end;
More information about the fpc-pascal
mailing list