Module: Puppet::Concurrent::ThreadLocalSingleton

Instance Method Summary collapse

Instance Method Details

#singletonObject


4
5
6
7
8
9
10
11
# File 'lib/puppet/concurrent/thread_local_singleton.rb', line 4

def singleton
  key = (name + ".singleton").intern
  thread = Thread.current
  unless thread.thread_variable?(key)
    thread.thread_variable_set(key, new)
  end
  thread.thread_variable_get(key)
end