class Concurrent::AtomicFixnum

@!macro [attach] atomic_fixnum

A numeric value that can be updated atomically. Reads and writes to an atomic
fixnum and thread-safe and guaranteed to succeed. Reads and writes may block
briefly but no explicit locking is required.

@!macro thread_safe_variable_comparison

    Testing with ruby 2.1.2
    Testing with Concurrent::MutexAtomicFixnum...
      3.130000   0.000000   3.130000 (  3.136505)
    Testing with Concurrent::CAtomicFixnum...
      0.790000   0.000000   0.790000 (  0.785550)

    Testing with jruby 1.9.3
    Testing with Concurrent::MutexAtomicFixnum...
      5.460000   2.460000   7.920000 (  3.715000)
    Testing with Concurrent::JavaAtomicFixnum...
      4.520000   0.030000   4.550000 (  1.187000)

@see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicLong.html java.util.concurrent.atomic.AtomicLong

@!macro atomic_fixnum_public_api

Public Instance Methods

to_s() click to toggle source

@return [String] Short string representation.

# File lib/concurrent/atomic/atomic_fixnum.rb, line 133
def to_s
  format '<#%s:0x%x value:%s>', self.class, object_id << 1, get
end