digitalmars.D.learn - How to open file with exclusive lock?
- Charles Hixson via Digitalmars-d-learn (8/8) Jul 12 2016 I want to open a file with an exclusive lock. It would be important
- Lodovico Giaretta (3/12) Jul 12 2016 [1] https://dlang.org/phobos/std_stdio.html#.File.lock
I want to open a file with an exclusive lock. It would be important that no other thread be able to access the file in write mode, and desirable that no other thread be able to access the file in read mode. (Ditto for other processes.) stdio.file.lock (or is it stdio.file.File.lock?) seems to demand a range of chunks to lock, but the file is not fixed in length. Is it appropriate to just specify the maximum possible number of bytes (i.e. ulong.max)?
Jul 12 2016
On Tuesday, 12 July 2016 at 18:54:18 UTC, Charles Hixson wrote:I want to open a file with an exclusive lock. It would be important that no other thread be able to access the file in write mode, and desirable that no other thread be able to access the file in read mode. (Ditto for other processes.) stdio.file.lock (or is it stdio.file.File.lock?) seems to demand a range of chunks to lock, but the file is not fixed in length. Is it appropriate to just specify the maximum possible number of bytes (i.e. ulong.max)?From the lock[1] description:If both start and length are zero, the entire file is locked.[1] https://dlang.org/phobos/std_stdio.html#.File.lock
Jul 12 2016