[fpc-pascal] Implementing a true Singleton - Can we decreasethevisibility of a method?

Matt Emson memsom at interalpha.co.uk
Mon Dec 11 15:09:48 CET 2006


> gINI and gLog are thread safe and well tested.

Out of interest, which type of locking mechanism do you use? I always favour
the "CanLock", "IsLocked", "Unclock" style mechanism ala:

 if not (res.Lock) then
begin
   ; //recover
end
else
try
  ; //do work
finally
  res.Unlock;
end;

But I do find it tiresom, so any alternatives that do not revolve around
"Critical Sections" (ala Windows) are always interesting to me. A lot of the
code I write can't block, so this type of mechanism needs to be employed.




More information about the fpc-pascal mailing list