[Glass] Is there a Smalltalk way to lock a file?

James Foster james.foster at gemtalksystems.com
Thu Mar 13 17:24:32 PDT 2014


On Mar 13, 2014, at 9:14 AM, Mariano Martinez Peck <marianopeck at gmail.com> wrote:

> Hi guys,
> 
> Do we have a method to lock a file at the OS level? I searched in image but I cannot find anything. If it would work in gemstone too that would be nice.
> 
> Thanks!
> 
> -- 
> Mariano
> http://marianopeck.wordpress.com

I was thinking that opening a file for write would be sufficient, but that isn’t what I found (on GS/S 64-bit 3.1.0.5 on Linux):

topaz> login
[03/13/2014 17:12:35.983 PDT]
  gci login: currSession 1 rpc gem processId 28015 OOB keep-alive interval 0
successful login
topaz 1> run
UserGlobals at: #'James1' put: (GsFile openAppendOnServer: 'test').
%
aGsFile
topaz 1> login
[03/13/2014 17:13:36.178 PDT]
  gci login: currSession 2 rpc gem processId 28021 OOB keep-alive interval 0
successful login
topaz 2> run
UserGlobals at: #'James2' put: (GsFile openAppendOnServer: 'test').
%
aGsFile
topaz 2> set session 1
topaz 1> run
James1 nextPutAll: 'This is from session 1'; cr.
%
true
topaz 1> set session 2
topaz 2> run
James2 nextPutAll: 'This is from session 2'; cr.
%
true
topaz 2> run
James2 close.
%
aGsFile
topaz 2> abort
topaz 2> logout
topaz> set session 1
topaz 1> run
James1 close.
%
aGsFile
topaz 1> abort
topaz 1> run
(GsFile openReadOnServer: 'test') contents
%
This is from session 1
This is from session 2

topaz 1> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20140313/8688043e/attachment.html>


More information about the Glass mailing list