Sha256: c1b1e9cfc75f7506731b3e7b9d5cd1a37d25903d1aad0cc9e68ed7dd87bb8b47

Contents?: true

Size: 362 Bytes

Versions: 20

Compression:

Stored size: 362 Bytes

Contents

# frozen_string_literal: true
module Puppet
  module Concurrent
    module ThreadLocalSingleton
      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
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puppet-7.12.1 lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.12.1-x86-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.12.1-x64-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.12.1-universal-darwin lib/puppet/concurrent/thread_local_singleton.rb
puppet-6.25.1 lib/puppet/concurrent/thread_local_singleton.rb
puppet-6.25.1-x86-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-6.25.1-x64-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-6.25.1-universal-darwin lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.12.0 lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.12.0-x86-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.12.0-x64-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.12.0-universal-darwin lib/puppet/concurrent/thread_local_singleton.rb
puppet-6.25.0 lib/puppet/concurrent/thread_local_singleton.rb
puppet-6.25.0-x86-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-6.25.0-x64-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-6.25.0-universal-darwin lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.11.0 lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.11.0-x86-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.11.0-x64-mingw32 lib/puppet/concurrent/thread_local_singleton.rb
puppet-7.11.0-universal-darwin lib/puppet/concurrent/thread_local_singleton.rb