<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Otto,<br>
    <br>
    There is file locking protocol in GsFile under category #locking.
    There are several caveats and restrictions so be sure to read the
    methods carefully. Also note that file locking over NFS is buggy and
    should not be relied upon. If your zip files are on NFS you could
    create a local (not on NFS) 1 byte file with a known name in a known
    location and lock it when the zip file is in use.<br>
    <br>
    There are other ways to do this as well as James says. For example,
    you could also use a shared counter (in class System) as your lock
    bit and use a KeyValueDictionary to map the file name to the shared
    counter ID.<br>
    <br>
    Norm Green<br>
    <br>
    <div class="moz-cite-prefix">On 6/2/2023 5:09 AM, Otto Behrens via
      Glass wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOJutV5eucxRs5_rPBvE63h8JP3fdyrKEjsWE6dmoz7eE-+Q+w@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>We have zipped files (references stored in GemStone with
          MAExternalFileModel) that we use in an operation, for example
          to merge PDF data (with PDFTk) or serve to the user via the
          web server, while it is temporarily unzipped. The code is
          something like this:</div>
        <div><br>
        </div>
        <div>operation: aBlock</div>
        <div>  tempFile := f unzip.</div>
        <div>  ^ [ aBlock value: tempFile ] ensure: [ tempFile remove ]</div>
        <div><br>
        </div>
        <div>We have on occasion multiple sessions that do operations on
          the same file, which causes a problem. We would like to
          protect the operation with a semaphore or something like that.</div>
        <div><br>
        </div>
        <div>Is a Semaphore the way to solve this or is there a better
          alternative?</div>
        <div><br>
        </div>
        <div>If we use Semaphore and store it on our file object, we
          cannot commit because we cannot persist the semaphore instVar.
          According to the programming guide, "if you need to
          encapsulate objects that should not be persistent, such as
          semaphores, within object structures that do need to be
          persistent and shared".</div>
        <div><br>
        </div>
        <div>I am unsure how to structure this or if this is a
          good idea. Can anyone please help?</div>
        <div><br>
        </div>
        <div>Kind regards</div>
        <div>
          <div>
            <div dir="ltr" class="gmail_signature"
              data-smartmail="gmail_signature">
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <table
                      style="color:rgb(0,0,0);font-family:Times;font-size:medium"
                      width="600" cellspacing="0" cellpadding="0"
                      border="0">
                      <tbody>
                        <tr>
                          <td width="400" valign="bottom">
                            <p style="margin:0px;padding:0px"><span
style="font-size:18px;color:rgb(146,148,151);font-family:Calibri,sans-serif;font-weight:700">Otto
                                Behrens</span><br>
                            </p>
                            <p
style="font-size:18px;font-weight:700;color:rgb(146,148,151);font-family:Calibri,sans-serif;margin:0px;padding:0px"><span
style="font-size:14px;font-weight:300;margin:0px;padding:0px">+27 82 809
                                2375</span></p>
                          </td>
                          <td width="200" valign="middle"><img
                              src="https://www.finworks.biz/signature/finworks-signature-logo.png"
                              alt="FINWorks"
style="display:block;border:0px;width:200px;height:38px;margin:0px;padding:0px"
                              moz-do-not-send="true" width="200"
                              height="38"></td>
                        </tr>
                      </tbody>
                    </table>
                    <table
                      style="color:rgb(0,0,0);font-family:Times;font-size:medium"
                      width="600" cellspacing="0" cellpadding="0"
                      border="0">
                      <tbody>
                        <tr>
                          <td height="5"><br>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                    <table
style="color:rgb(0,0,0);font-family:Times;font-size:medium;border-bottom:1px
                      solid rgb(200,28,36)" width="600" cellspacing="0"
                      cellpadding="0" border="0">
                      <tbody>
                        <tr>
                          <td height="15"><br>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                    <table
                      style="color:rgb(0,0,0);font-family:Times;font-size:medium"
                      width="600" cellspacing="0" cellpadding="0"
                      border="0">
                      <tbody>
                        <tr>
                          <td height="20"><br>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                    <table
                      style="color:rgb(0,0,0);font-family:Times;font-size:medium"
                      width="600" cellspacing="0" cellpadding="0"
                      border="0">
                      <tbody>
                        <tr>
                          <td style="display:inline-block" width="15"
                            valign="top"><a
                              href="http://za.linkedin.com/in/waltherbehrens"
                              style="color:rgb(17,85,204)"
                              target="_blank" moz-do-not-send="true"><img
src="https://www.finworks.biz/signature/finworks-linkedin-logo.png"
                                alt="FINWorks"
style="display:inline-block;border:0px;width:15px;height:15px;margin-top:1.5px;padding:0px"
                                moz-do-not-send="true" width="15"
                                height="15"></a></td>
                          <td style="display:inline-block" width="250"
                            valign="top"><a
                              href="http://www.finworks.biz/"
style="color:rgb(200,28,36);font-family:Calibri,sans-serif;margin-left:10px;margin-top:0px;padding-top:0px;font-size:11pt;display:inline-block"
                              target="_blank" moz-do-not-send="true">www.finworks.biz</a></td>
                        </tr>
                      </tbody>
                    </table>
                    <table
                      style="color:rgb(0,0,0);font-family:Times;font-size:medium"
                      width="600" cellspacing="0" cellpadding="0"
                      border="0">
                      <tbody>
                        <tr>
                          <td height="10"><br>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                    <table
                      style="color:rgb(0,0,0);font-family:Times;font-size:medium"
                      width="600" cellspacing="0" cellpadding="0"
                      border="0">
                      <tbody>
                        <tr>
                          <td>
                            <p
style="font-size:10px;color:rgb(146,148,151);font-family:Calibri,sans-serif;text-align:justify">Disclaimer
                              & Confidentiality Note: This email is
                              intended solely for the use of the
                              individual or entity named above as it may
                              contain information that is confidential
                              and privileged. If you are not the
                              intended recipient, be advised that any
                              dissemination, distribution or copying of
                              this email is strictly prohibited.
                              FINWorks cannot be held liable by any
                              person other than the addressee in respect
                              of any opinions, conclusions, advice or
                              other information contained in this email.</p>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Glass mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Glass@lists.gemtalksystems.com">Glass@lists.gemtalksystems.com</a>
<a class="moz-txt-link-freetext" href="https://lists.gemtalksystems.com/mailman/listinfo/glass">https://lists.gemtalksystems.com/mailman/listinfo/glass</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>