I'm trying to implement a simple semaphore to protect critical sections
of code with the following procedures.
Question is are these safe, or is it possible that 2 threads could slip
through EnterCritical at the same time?
Thanks
procedure EnterCritical;
begin
while semaphore do sleep(30);
semaphore:=true;
end;
procedure ExitCritical;
begin
semaphore:=false;
end;