Class List Method List File List

# Top Level Namespace

## Defined Under Namespace

Modules: Concurrent

## Instance Method Summary (collapse)

- - (Boolean) compare_and_set

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

- - (Object) get

  Gets the current value.

- - (Object) get_and_set

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

- - (undocumented) initialize
- - (Object) set

  Sets to the given value.

## Instance Method Details

### - (`Boolean`) compare_and_set

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

    44

    # File 'lib/concurrent/atomics.rb', line 44

    require 'concurrent/atomic/atomic_reference'

### - (`Object`) get

Gets the current value.

Returns:

- (`Object`) —

  the current value

    44

    # File 'lib/concurrent/atomics.rb', line 44

    require 'concurrent/atomic/atomic_reference'

### - (`Object`) get_and_set

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

Parameters:

- new_value (`Object`) —

  the new value

Returns:

- (`Object`) —

  the old value

    44

    # File 'lib/concurrent/atomics.rb', line 44

    require 'concurrent/atomic/atomic_reference'

### - (`undocumented`) initialize

Parameters:

- value (`Object`) —

  The initial value.

    44

    # File 'lib/concurrent/atomics.rb', line 44

    require 'concurrent/atomic/atomic_reference'

### - (`Object`) set

Sets to the given value.

Parameters:

- new_value (`Object`) —

  the new value

Returns:

- (`Object`) —

  the new value

    44

    # File 'lib/concurrent/atomics.rb', line 44

    require 'concurrent/atomic/atomic_reference'