<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On 07/30/2015 10:38 AM, Peter Levart
      wrote:<br>
    </div>
    <blockquote cite="mid:55B9E293.80102@gmail.com" type="cite">
      <blockquote type="cite" style="color: #000000;">[This suggests the
        r.queue = NULL assignment in reallyPoll() should be
        <br>
        moved later, though I think the assignment order in reallyPoll()
        <br>
        doesn't matter.]
        <br>
      </blockquote>
      <br>
      I think the assignment to r.queue = NULL in realyPoll() should be
      moved <b class="moz-txt-star"><span class="moz-txt-tag">*</span>before<span
          class="moz-txt-tag">*</span></b> the assignment to 'head'
      (which might assign null if 'r' was the last element). Here's why:
      <br>
      <br>
      Suppose we have a Reference 'r' and it's associated ReferenceQueue
      'q'. Currently it can happen that the following evaluates to true,
      which is surprising:
      <br>
      <br>
      q.poll() == null && r.isEnqueued()
      <br>
      <br>
      <br>
      Regards, Peter
    </blockquote>
    <br>
    Well, the above condition is not very representative of the
    situation I'm trying to describe. It can be perfectly legal when
    racing with enqueueing of the Reference 'r'. But when racing with
    de-queueing (i.e. poll()) it is surprising. So let me re-phrase the
    expression which is always surprising when it evaluates to true:<br>
    <br>
    r.isEnqueued()
    && q.poll() == null && r.isEnqueued()<br>
    <br>
    Regards, Peter<br>
    <br>
  </body>
</html>