file locks
Sean Kelly
sean at invisibleduck.org
Wed Jul 30 10:54:43 PDT 2008
BCS wrote:
> 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.
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.
Sean
More information about the Digitalmars-d-learn
mailing list