RosettaCodeData/Task/Singleton/Oz/singleton.oz
2023-07-01 13:44:08 -04:00

19 lines
273 B
Text

declare
local
class Singleton
meth init
skip
end
end
L = {NewLock}
Instance
in
fun {GetInstance}
lock L then
if {IsFree Instance} then
Instance = {New Singleton init}
end
Instance
end
end
end