digitalmars.D.learn - file locks
- llee (1/1) Jul 30 2008 Is there any way to lock a file in D. I'm writing an application that ne...
- BCS (3/8) Jul 30 2008 there may be some D library calls to do it (I haven't seen one, or looke...
- Sean Kelly (6/17) Jul 30 2008 On POSIX systems, file locking is purely cooperative. There is no way
- Koroskin Denis (9/13) Jul 30 2008 In Tango, when you create a FileConduit you specify a Share attribute th...
- llee (2/19) Jul 30 2008 Looks good, but I'm using Phobos.
- Rakan Alhneiti (5/25) Jul 30 2008 AFAIK, on windows, opening a file in binary mode locks the file from
Is there any way to lock a file in D. I'm writing an application that needs to support concurrent access to a file, and would like to lock the file during write operations to prevent other process instances from reading invalid data.
Jul 30 2008
Reply to llee,Is there any way to lock a file in D. I'm writing an application that needs to support concurrent access to a file, and would like to lock the file during write operations to prevent other process instances from reading invalid data.there may be some D library calls to do it (I haven't seen one, or looked) but if there isn't, you can always fall back on however you would do it in C.
Jul 30 2008
BCS wrote:Reply to llee,On POSIX systems, file locking is purely cooperative. There is no way to prevent users from opening your file if they so choose. For this reason, I consider file locking largely useless beyond the scope of how a specific application behaves with respect to files it controls. SeanIs there any way to lock a file in D. I'm writing an application that needs to support concurrent access to a file, and would like to lock the file during write operations to prevent other process instances from reading invalid data.there may be some D library calls to do it (I haven't seen one, or looked) but if there isn't, you can always fall back on however you would do it in C.
Jul 30 2008
On Wed, 30 Jul 2008 20:14:59 +0400, llee <llee goucher.edu> wrote:Is there any way to lock a file in D. I'm writing an application that needs to support concurrent access to a file, and would like to lock the file during write operations to prevent other process instances from reading invalid data.In Tango, when you create a FileConduit you specify a Share attribute that affects concurrent file access policy: enum Share : ubyte { None=0, /// no sharing Read, /// shared reading ReadWrite, /// open for anything } Is it what are you looking for?
Jul 30 2008
Koroskin Denis Wrote:On Wed, 30 Jul 2008 20:14:59 +0400, llee <llee goucher.edu> wrote:Looks good, but I'm using Phobos.Is there any way to lock a file in D. I'm writing an application that needs to support concurrent access to a file, and would like to lock the file during write operations to prevent other process instances from reading invalid data.In Tango, when you create a FileConduit you specify a Share attribute that affects concurrent file access policy: enum Share : ubyte { None=0, /// no sharing Read, /// shared reading ReadWrite, /// open for anything } Is it what are you looking for?
Jul 30 2008
llee wrote:Koroskin Denis Wrote:AFAIK, on windows, opening a file in binary mode locks the file from being opened. it displays "Already in use" message. i wrote a program to lock files in vb6 years ago and it worked. Dont know about Linux and it's behavior on such thingOn Wed, 30 Jul 2008 20:14:59 +0400, llee <llee goucher.edu> wrote:Looks good, but I'm using Phobos.Is there any way to lock a file in D. I'm writing an application that needs to support concurrent access to a file, and would like to lock the file during write operations to prevent other process instances from reading invalid data.In Tango, when you create a FileConduit you specify a Share attribute that affects concurrent file access policy: enum Share : ubyte { None=0, /// no sharing Read, /// shared reading ReadWrite, /// open for anything } Is it what are you looking for?
Jul 30 2008