<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<br>
Hi Dave, <br>
<br>
extra information is extremely welcomed ! Thank you !<br>
<br>
The day I absolutely needed it i solved with a temporary hack,<br>
I sent from Cuis this command, to read a file:<br>
flock fooFile.txt -c 'cat fooFile.txt'<br>
<br>
I will hit the necessity of using a lock again, next time I am going
to implement it well.<br>
<br>
When I will do I will also document a minimum procedure for future
users in the<br>
"CuisCook", there at the moment there is only a reference to the
info you sent me.<br>
That is already a very good starting point !<br>
<br>
Thank you again<br>
<br>
bye<br>
Nicola<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 9/24/21 2:12 AM, David T. Lewis via
Cuis-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:20210924001239.GA64936@shell.msen.com">
<pre class="moz-quote-pre" wrap="">Nicola,
Here is a bit more information for background.
File locking is done with posix advisory file locking, as describe in the
man(2) flock man page <a class="moz-txt-link-freetext" href="https://man7.org/linux/man-pages/man2/fcntl.2.html">https://man7.org/linux/man-pages/man2/fcntl.2.html</a>
The necessary primitives are in all of the unix VMs, and are implemented
in the UnixOSProcessPlugin. The plugin source is maintained at
<a class="moz-txt-link-freetext" href="http://www.squeaksource.com/OSProcessPlugin">http://www.squeaksource.com/OSProcessPlugin</a>.
I am attaching a copy of the three primitive methods so you can
see what they are doing. These are Smalltalk methods in the plugin
that are translated to C code. You can find the generated C code
for these methods somewhere in the plugin code at
<a class="moz-txt-link-freetext" href="http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c?revision=3807&view=markup">http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c?revision=3807&view=markup</a>
The methods in package OSProcess make use of these primitives to implement
file locking in Squeak/Cuis, and the unit tests that I referenced show how
it works in the image. UnixOSProcessAccessor provides the direct interface
to the primitives (see category 'file locking'), and OSFileLock and
OSFileRegionLock represent locks on files or regions within a file.
HTH,
Dave
On Wed, Sep 22, 2021 at 10:19:57AM +0200, Nicola Mingotti via Cuis-dev wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">
thank you Dave, I will study it.
bye
Nicola
On 9/21/21 10:08 PM, David T. Lewis wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On Tue, Sep 21, 2021 at 10:57:16AM +0200, Nicola Mingotti via Cuis-dev
wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Hi again,
I have another question, as far as you know is it already implemented
somewhere and equivalent of Unix 'flock' ?
bye
Nicola
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Hi Nicola,
Try loading OSProcess (Feature require: 'OSProcess').
Then look at UnixProcessFileLockTestCase for examples of how the file
locking works on Unix/Linux and OS X.
Dave
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
--
Cuis-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Cuis-dev@lists.cuis.st">Cuis-dev@lists.cuis.st</a>
<a class="moz-txt-link-freetext" href="https://lists.cuis.st/mailman/listinfo/cuis-dev">https://lists.cuis.st/mailman/listinfo/cuis-dev</a>
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
</blockquote>
</blockquote>
<br>
</body>
</html>