Sha256: 80037211f1b86725d9ec8982252aadae4e671be01e93e29300ed9dc9b8f06a7f

Contents?: true

Size: 534 Bytes

Versions: 8

Compression:

Stored size: 534 Bytes

Contents

module Concurrent

  module AtomicNumericCompareAndSetWrapper
    #alias _compare_and_set compare_and_set

    def compare_and_set(expected, new)
      if expected.kind_of? Numeric
        while true
          old = get

          return false unless old.kind_of? Numeric

          return false unless old == expected

          result = _compare_and_set(old, new)
          return result if result
        end
      else
        _compare_and_set(expected, new)
      end
    end
    alias compare_and_swap compare_and_set
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
concurrent-ruby-0.7.0.rc0 lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
concurrent-ruby-0.7.0.rc0-x86_64-linux lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
concurrent-ruby-0.7.0.rc0-x86_64-darwin-13 lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
concurrent-ruby-0.7.0.rc0-x86-solaris-2.11 lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
concurrent-ruby-0.7.0.rc0-x86-mingw32 lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
concurrent-ruby-0.7.0.rc0-x86-linux lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
concurrent-ruby-0.7.0.rc0-x64-mingw32 lib/concurrent/atomic_reference/numeric_cas_wrapper.rb
concurrent-ruby-0.7.0.rc0-java lib/concurrent/atomic_reference/numeric_cas_wrapper.rb