class Concurrent::LockFreeStack

def clear

Returns:
  • (true, false) -
def clear
  while true
    current_head = head
    return false if current_head == EMPTY
    return true if compare_and_set_head current_head, EMPTY
  end
end