Sha256: 021b9751f76d618c50f3d85f70c17a7a66c87239cba7c0f7b2fd76db9dee5718

Contents?: true

Size: 387 Bytes

Versions: 32

Compression:

Stored size: 387 Bytes

Contents

# frozen_string_literal: true

module Puppet
  module Concurrent
    module ThreadLocalSingleton
      def singleton
        key = (name + ".singleton").intern
        thread = Thread.current
        value = thread.thread_variable_get(key)
        if value.nil?
          value = new
          thread.thread_variable_set(key, value)
        end
        value
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
puppet-8.10.0 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.10.0-x86-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.10.0-x64-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.10.0-universal-darwin lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.9.0 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.9.0-x86-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.9.0-x64-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.9.0-universal-darwin lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.8.1 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.8.1-x86-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.8.1-x64-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.8.1-universal-darwin lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.7.0 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.7.0-x86-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.7.0-x64-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.7.0-universal-darwin lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.6.0 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.6.0-x86-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.6.0-x64-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-8.6.0-universal-darwin lib/puppet/concurrent/thread_local_singleton.rb