<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: Concurrent::LockFreeQueue::Node
  
    &mdash; Concurrent Ruby
  
</title>

  <link rel="stylesheet" href="../../css/style.css" type="text/css" />

  <link rel="stylesheet" href="../../css/common.css" type="text/css" />

<script type="text/javascript">
  pathId = "Concurrent::LockFreeQueue::Node";
  relpath = '../../';
</script>


  <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="../../class_list.html?1"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="../../_index.html">Index (N)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../../Concurrent.html" title="Concurrent (module)">Concurrent</a></span></span> &raquo; <span class='title'><span class='object_link'>LockFreeQueue</span></span>
     &raquo; 
    <span class="title">Node</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../../class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <div id="content"><h1>Class: Concurrent::LockFreeQueue::Node
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName"><span class='object_link'><a href="../Synchronization/Object.html" title="Concurrent::Synchronization::Object (class)">Synchronization::Object</a></span></span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next"><span class='object_link'><a href="../Synchronization/Object.html" title="Concurrent::Synchronization::Object (class)">Synchronization::Object</a></span></li>
          
            <li class="next">Concurrent::LockFreeQueue::Node</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  

  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb</dd>
  </dl>
  
</div>

<div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  

</div>






  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#compare_and_set_successor-instance_method" title="#compare_and_set_successor (instance method)">#<strong>compare_and_set_successor</strong>(expected_successor, new_successor)  &#x21d2; true, false </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Sets the successor to new_successor if the current successor is expected_successor.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(item, successor)  &#x21d2; Node </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>A new instance of Node.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#item-instance_method" title="#item (instance method)">#<strong>item</strong>  &#x21d2; undocumented </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#successor-instance_method" title="#successor (instance method)">#<strong>successor</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>The successor.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#successor=-instance_method" title="#successor= (instance method)">#<strong>successor=</strong>(new_successor)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Set the successor.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#swap_successor-instance_method" title="#swap_successor (instance method)">#<strong>swap_successor</strong>(new_successor)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Set the successor to new_successor and return the old successor.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#update_successor-instance_method" title="#update_successor (instance method)">#<strong>update_successor</strong> {|Object| ... } &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Updates the successor using the block.</p>
</div></span>
  
</li>

      
    </ul>
  


  
  <div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    #<strong>initialize</strong>(item, successor)  &#x21d2; <tt><span class='object_link'><a href="" title="Concurrent::LockFreeQueue::Node (class)">Node</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns a new instance of Node.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


9
10
11
12
13
14</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 9</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='comma'>,</span> <span class='id identifier rubyid_successor'>successor</span><span class='rparen'>)</span>
  <span class='kw'>super</span><span class='lparen'>(</span><span class='rparen'>)</span>
  <span class='comment'># published through queue, no need to be volatile or final
</span>  <span class='ivar'>@Item</span>          <span class='op'>=</span> <span class='id identifier rubyid_item'>item</span>
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_successor'>successor</span> <span class='op'>=</span> <span class='id identifier rubyid_successor'>successor</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="compare_and_set_successor-instance_method">
  
    #<strong>compare_and_set_successor</strong>(expected_successor, new_successor)  &#x21d2; <tt>true</tt>, <tt>false</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Sets the successor to new_successor if the current successor is expected_successor</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


7</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 7</span>

<span class='id identifier rubyid_attr_atomic'>attr_atomic</span> <span class='symbol'>:successor</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="item-instance_method">
  
    #<strong>item</strong>  &#x21d2; <tt>undocumented</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


16
17
18</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 16</span>

<span class='kw'>def</span> <span class='id identifier rubyid_item'>item</span>
  <span class='ivar'>@Item</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="successor-instance_method">
  
    #<strong>successor</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns The successor.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Object</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The successor.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


7</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 7</span>

<span class='id identifier rubyid_attr_atomic'>attr_atomic</span> <span class='symbol'>:successor</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="successor=-instance_method">
  
    #<strong>successor=</strong>(new_successor)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Set the successor.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Object</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>new_successor.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


7</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 7</span>

<span class='id identifier rubyid_attr_atomic'>attr_atomic</span> <span class='symbol'>:successor</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="swap_successor-instance_method">
  
    #<strong>swap_successor</strong>(new_successor)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Set the successor to new_successor and return the old successor.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Object</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>old successor</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


7</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 7</span>

<span class='id identifier rubyid_attr_atomic'>attr_atomic</span> <span class='symbol'>:successor</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="update_successor-instance_method">
  
    #<strong>update_successor</strong> {|Object| ... } &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Updates the successor using the block.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>Object</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>Calculate a new successor using given (old) successor</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
  
    <li>
      
        <span class='name'>old</span>
      
      
        <span class='type'>(<tt>Object</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>successor</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Object</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>new successor</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


7</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/concurrent-ruby-edge/concurrent/edge/lock_free_queue.rb', line 7</span>

<span class='id identifier rubyid_attr_atomic'>attr_atomic</span> <span class='symbol'>:successor</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_blank">yard</a>.
</div>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-57940973-1', 'auto');
  ga('send', 'pageview');

</script>

    </div>
  </body>
</html>