123456789_123456789_123456789_123456789_123456789_

Class: Concurrent::LockFreeQueue::Node

Class Attribute Summary

Class Method Summary

Synchronization::Object - Inherited

.atomic_attribute?, .atomic_attributes,
.attr_atomic

Creates methods for reading and writing to a instance variable with volatile (Java) semantic as .attr_volatile does.

.attr_volatile

Creates methods for reading and writing (as attr_accessor does) to a instance variable with volatile (Java) semantic.

.ensure_safe_initialization_when_final_fields_are_present

For testing purposes, quite slow.

.new

Has to be called by children.

.safe_initialization!, .define_initialize_atomic_fields

Synchronization::AbstractObject - Inherited

Instance Method Summary

Constructor Details

.new(item, successor) ⇒ Node

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 11

def initialize(item, successor)
  super()
  # published through queue, no need to be volatile or final
  @Item          = item
  self.successor = successor
end

Instance Method Details

#compare_and_set_successor(expected_successor, new_successor) ⇒ true, false

Sets the successor to new_successor if the current successor is expected_successor

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 9

attr_atomic :successor

#item

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 18

def item
  @Item
end

#successorObject

Returns:

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 9

attr_atomic :successor

#successor=(new_successor) ⇒ Object

Set the successor.

Returns:

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 9

attr_atomic :successor

#swap_successor(new_successor) ⇒ Object

Set the successor to new_successor and return the old successor.

Returns:

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 9

attr_atomic :successor

#update_successor {|Object| ... } ⇒ Object

Updates the successor using the block.

Yields:

  • (Object)

    Calculate a new successor using given (old) successor

Yield Parameters:

Returns:

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 9

attr_atomic :successor