Skip to content

Instantly share code, notes, and snippets.

@divoxx
Created December 15, 2016 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save divoxx/fffbb9d03e3b014e85826b3c5b9ced77 to your computer and use it in GitHub Desktop.
Save divoxx/fffbb9d03e3b014e85826b3c5b9ced77 to your computer and use it in GitHub Desktop.
class Foo
@@mutex = Mutex.new
def self.something
@@mutex.synchronize do
return @something if defined?(@something)
@something = init_here
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment