Exception: Concurrent::ConcurrentUpdateError

Inherits:
ThreadError
  • Object
show all
Defined in:
lib/concurrent/atomic_reference/concurrent_update_error.rb

Overview

An object reference that may be updated atomically. All read and write operations have java volatile semantic.

Testing with ruby 2.1.2 Testing with Concurrent::MutexAtomicBoolean…

2.790000   0.000000   2.790000 (  2.791454)

Testing with Concurrent::CAtomicBoolean…

0.740000   0.000000   0.740000 (  0.740206)

Testing with jruby 1.9.3 Testing with Concurrent::MutexAtomicBoolean…

5.240000   2.520000   7.760000 (  3.683000)

Testing with Concurrent::JavaAtomicBoolean…

3.340000   0.010000   3.350000 (  0.855000)

Constant Summary collapse

CONC_UP_ERR_BACKTRACE =

frozen pre-allocated backtrace to speed ConcurrentUpdateError

['backtrace elided; set verbose to enable'].freeze

Instance Method Summary collapse

Constructor Details

#initializeObject

Parameters:

  • value (Object)

    The initial value.



4
5
6
7
# File 'lib/concurrent/atomic_reference/concurrent_update_error.rb', line 4

class ConcurrentUpdateError < ThreadError
  # frozen pre-allocated backtrace to speed ConcurrentUpdateError
  CONC_UP_ERR_BACKTRACE = ['backtrace elided; set verbose to enable'].freeze
end

Instance Method Details

#compare_and_setBoolean

Atomically sets the value to the given updated value if the current value == the expected value.

that the actual value was not equal to the expected value.

Parameters:

  • old_value (Object)

    the expected value

  • new_value (Object)

    the new value

Returns:

  • (Boolean)

    ‘true` if successful. A `false` return indicates



4
5
6
7
# File 'lib/concurrent/atomic_reference/concurrent_update_error.rb', line 4

class ConcurrentUpdateError < ThreadError
  # frozen pre-allocated backtrace to speed ConcurrentUpdateError
  CONC_UP_ERR_BACKTRACE = ['backtrace elided; set verbose to enable'].freeze
end

#getObject

Gets the current value.

Returns:

  • (Object)

    the current value



4
5
6
7
# File 'lib/concurrent/atomic_reference/concurrent_update_error.rb', line 4

class ConcurrentUpdateError < ThreadError
  # frozen pre-allocated backtrace to speed ConcurrentUpdateError
  CONC_UP_ERR_BACKTRACE = ['backtrace elided; set verbose to enable'].freeze
end

#get_and_setObject

Atomically sets to the given value and returns the old value.

Parameters:

  • new_value (Object)

    the new value

Returns:

  • (Object)

    the old value



4
5
6
7
# File 'lib/concurrent/atomic_reference/concurrent_update_error.rb', line 4

class ConcurrentUpdateError < ThreadError
  # frozen pre-allocated backtrace to speed ConcurrentUpdateError
  CONC_UP_ERR_BACKTRACE = ['backtrace elided; set verbose to enable'].freeze
end

#setObject

Sets to the given value.

Parameters:

  • new_value (Object)

    the new value

Returns:

  • (Object)

    the new value



4
5
6
7
# File 'lib/concurrent/atomic_reference/concurrent_update_error.rb', line 4

class ConcurrentUpdateError < ThreadError
  # frozen pre-allocated backtrace to speed ConcurrentUpdateError
  CONC_UP_ERR_BACKTRACE = ['backtrace elided; set verbose to enable'].freeze
end