Sha256: 7bef40c5b8efa1520e81b24c2209cf2d926c1303b346464f17a34b6259fc0877

Contents?: true

Size: 1.24 KB

Versions: 118

Compression:

Stored size: 1.24 KB

Contents

require 'concurrent/synchronization'

module Concurrent

  # @!macro atomic_boolean
  # @!visibility private
  # @!macro internal_implementation_note
  class MutexAtomicBoolean < Synchronization::LockableObject

    # @!macro atomic_boolean_method_initialize
    def initialize(initial = false)
      super()
      synchronize { ns_initialize(initial) }
    end

    # @!macro atomic_boolean_method_value_get
    def value
      synchronize { @value }
    end

    # @!macro atomic_boolean_method_value_set
    def value=(value)
      synchronize { @value = !!value }
    end

    # @!macro atomic_boolean_method_true_question
    def true?
      synchronize { @value }
    end

    # @!macro atomic_boolean_method_false_question
    def false?
      synchronize { !@value }
    end

    # @!macro atomic_boolean_method_make_true
    def make_true
      synchronize { ns_make_value(true) }
    end

    # @!macro atomic_boolean_method_make_false
    def make_false
      synchronize { ns_make_value(false) }
    end

    protected

    # @!visibility private
    def ns_initialize(initial)
      @value = !!initial
    end

    private

    # @!visibility private
    def ns_make_value(value)
      old = @value
      @value = value
      old != @value
    end
  end
end

Version data entries

118 entries across 104 versions & 25 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/atomic/mutex_atomic_boolean.rb