Class: Concurrent::Edge::LockFreeLinkedSet::Tail

Inherits:
Node
  • Object
show all
Defined in:
lib/concurrent/edge/lock_free_linked_set/node.rb

Overview

Internal sentinel node for the Tail. It is always greater than all other nodes, and it is self-referential; meaning its successor is a self-loop.

Instance Attribute Summary

Attributes inherited from Node

#Data, #Key, #Successor_reference

Instance Method Summary collapse

Methods inherited from Node

#key_for, #last?, #next_node

Constructor Details

#initialize(_data = nil, _succ = nil) ⇒ Tail

Returns a new instance of Tail.



51
52
53
# File 'lib/concurrent/edge/lock_free_linked_set/node.rb', line 51

def initialize(_data = nil, _succ = nil)
  @Successor_reference = AtomicMarkableReference.new self
end

Instance Method Details

#<=>(_other) ⇒ Object

Always greater than other nodes. This means that traversal will end at the tail node since we are comparing node size in the traversal.



57
58
59
# File 'lib/concurrent/edge/lock_free_linked_set/node.rb', line 57

def <=>(_other)
  1
end