<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 10/02/2014 05:03 PM, Xiangrong Fang
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAP93jB3PRaRBSqWp70NmRgy=SuS4ncy1kBpX3V6AnVM7YxpxfQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_default" style="font-family:'courier
          new',monospace"><br>
        </div>
        <div class="gmail_extra">
          <div class="gmail_quote"><br>
            <div class="gmail_default" style="font-family:'courier
              new',monospace"><br>
            </div>
            <div class="gmail_default">
              <blockquote style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"
                class="gmail_quote"><font face="courier new, monospace">For
                  Windows, critical sections are lighter-weight than
                  mutexes.<br>
                </font><font face="courier new, monospace">Mutexes can
                  be shared between processes, but always result in a
                  system call to the kernel which has some overhead. </font><font
                  face="courier new, monospace">Critical sections can
                  only be used within one process, but have the
                  advantage that they only switch to kernel mode in the
                  case of contention.</font></blockquote>
              <div><br>
              </div>
              <div><font face="courier new, monospace">I only need lock
                  WITHIN my own application, so, it seems that critical
                  sections are better.</font></div>
              <br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <font face="courier new, monospace">So it seems that </font>Windows
    in fact does a kind of FUTEX for inter-Thread synchronizing (as does
    pthredlib, that as it's name says just provides  POSIX-operation
    within Threads, not between applications.)<br>
    <br>
    Hence, provided TCrtiticalSections uses the Windows system DLL in
    Windows and the pthreadlib so in Linux, the resulting performance
    should  be very similar.  <br>
    <br>
    -Michael<br>
  </body>
</html>