<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 3, 2013 at 2:06 AM, Vicente J. Botet Escriba <span dir="ltr">&lt;<a href="mailto:vicente.botet@wanadoo.fr" target="_blank">vicente.botet@wanadoo.fr</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Le 02/01/13 23:33, Fredrik Orderud a
      écrit :<br>
    </div><div class="im">
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
              <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            </blockquote>
            <div>
            </div>
            <div>The reason why I&#39;m asking is that
              exclusive_waiting_blocked is reset on failed timed_lock()
              requests. This seems a bit strange in my eyes, since this
              should be a no-op and there might still be blocked
              exclusive-lock requests present. I also won&#39;t be surprised
              if there are issues related to the reset of the flag in
              unlock() and unlock_shared() when several exclusive-lock
              requests queued up. I&#39;ve attached some test code that
              demonstrates change in behaviour after a failed
              timed_lock() request (not the best code, but it should
              illustrate my point).<br>
              <br>
            </div>
            <div>In my eyes, it would be more natural to instead have a
              counter for the number of exclusive-lock requests (as in
              my shared_pri_mutex code sample from 2012-12-17). This
              should make it easier to get consistent behaviour on
              failed xxx_lock() requests and facillitate implementation
              of different priority policies. It might, however, be some
              clever aspect of exclusive_waiting_blocked that I&#39;m
              overlooking or don&#39;t understand. Any comments on this?<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote></div>
    I can not add more that I did for the moment. Anyway, I don&#39;t see
    what your test is proving. Maybe you could remove this flag and see
    how it behaves, is it more fair?<br></div></blockquote><div><br></div><div>The idea of the test code was to illustrate that a failed timed_lock (which should ideally be side-effect free) still affects reader vs. writer lock acquisition order. If you run the test as-is- several times then excusive_thread will be acquired first in ~90% of the times, while shared_thread will be acquired first in ~90% of the time when RESET_EXCLUSIVE_WAITING_BLOCKED has been defined.<br>
<br></div><div>Regards,<br>Fredrik<br></div></div></div></div>

