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. _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Not aware of a way to do it directly... If you can do it from the shell, then System class>>performOnServer: will be your friend:) Dale
On Thu, Mar 13, 2014 at 9:14 AM, Mariano Martinez Peck <[hidden email]> wrote:
_______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Administrator
|
In reply to this post by Mariano Martinez Peck
It's not clear what your intention is. Typically, opening a file for write access should prevent any other process from opening it (for write access). I think the semantics of file access are operating system specific. But most OS's should come close to what's defined for Posix, I expect. (Windows maybe not so close.) |
In reply to this post by Mariano Martinez Peck
On Mar 13, 2014, at 9:14 AM, Mariano Martinez Peck <[hidden email]> wrote:
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> _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
On 03/13/2014 05:24 PM, James Foster wrote:
> On Mar 13, 2014, at 9:14 AM, Mariano Martinez Peck > <[hidden email] <mailto:[hidden email]>> 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): The common type of file locking in Linux is advisory, and therefore not enforced. Locks must be explicitly obtained and checked. See http://en.wikipedia.org/wiki/File_locking#In_Unix-like_systems for more information. In GemStone/S, a #performOnServer: of flock is probably the way to go, using the fileDescriptor of the GsFile as an argument. Regards, -Martin _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Free forum by Nabble | Edit this page |