Sha256: 10b960a6dd0588f02fa0d04a8fe8621498cf95187ae4af2a2a0ed76831424bc9

Contents?: true

Size: 1.23 KB

Versions: 91

Compression:

Stored size: 1.23 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

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

Version data entries

91 entries across 85 versions & 22 rubygems

Version Path
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.3.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.3.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/atomic/mutex_atomic_boolean.rb
tdiary-5.0.11 vendor/bundle/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
concurrent-ruby-1.1.0.pre2 lib/concurrent/atomic/mutex_atomic_boolean.rb
concurrent-ruby-1.1.0.pre1 lib/concurrent/atomic/mutex_atomic_boolean.rb
sprokovuln-0.2.0 vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/concurrent-ruby-1.0.5-java/lib/concurrent/atomic/mutex_atomic_boolean.rb
tdiary-5.0.9 vendor/bundle/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
mrcooper-logstash-output-azuresearch-0.2.2 vendor/jruby/2.5.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/atomic/mutex_atomic_boolean.rb
monero_wallet_gen-0.1.0 vendor/bundle/ruby/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
tdiary-5.0.8 vendor/bundle/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
tdiary-5.0.7 vendor/bundle/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
pract6-0.1.0 .gem/ruby/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/concurrent-ruby-1.0.0-java/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/concurrent-ruby-1.0.0-java/lib/concurrent/atomic/mutex_atomic_boolean.rb
tdiary-5.0.6 vendor/bundle/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/concurrent-ruby-1.0.5-java/lib/concurrent/atomic/mutex_atomic_boolean.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/concurrent-ruby-1.0.5-java/lib/concurrent/atomic/mutex_atomic_boolean.rb