Parent

Included Modules

Files

Class/Module Index [+]

Quicksearch

Concurrent::Edge::LockFreeLinkedSet::Node

Attributes

Data[R]
Key[R]
Successor_reference[R]

Public Class Methods

new(data = nil, successor = nil) click to toggle source
# File lib/concurrent/edge/lock_free_linked_set/node.rb, line 11
def initialize(data = nil, successor = nil)
  super()

  @Successor_reference = AtomicMarkableReference.new(successor || Tail.new)
  @Data = data
  @Key = key_for data

  ensure_ivar_visibility!
end

Public Instance Methods

<=>(other) click to toggle source

We use `Object#hash` as a way to enforce ordering on the nodes. This can be configurable in the future; for example, you could enforce a split-ordering on the nodes in the set.

# File lib/concurrent/edge/lock_free_linked_set/node.rb, line 42
def <=>(other)
  @Key <=> other.hash
end
key_for(data) click to toggle source

This method provides a unqiue key for the data which will be used for ordering. This is configurable, and changes depending on how you wish the nodes to be ordered.

# File lib/concurrent/edge/lock_free_linked_set/node.rb, line 35
def key_for(data)
  data.hash
end
last?() click to toggle source

Check to see if the node is the last in the list.

# File lib/concurrent/edge/lock_free_linked_set/node.rb, line 22
def last?
  @Successor_reference.value.is_a? Tail
end
next_node() click to toggle source

Next node in the list. Note: this is not the AtomicMarkableReference of the next node, this is the actual Node itself.

# File lib/concurrent/edge/lock_free_linked_set/node.rb, line 28
def next_node
  @Successor_reference.value
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.