A Global Singleton is a class of which only one instance exists within a program.

Any attempt to use non-static members of the class involves performing operations on this one instance.




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