Boost logo

Boost Users :

Subject: Re: [Boost-users] [Filesystem] Locking files
From: Frank Meerkötter (frank_at_[hidden])
Date: 2010-04-13 04:46:33


On 04/13/2010 10:02 AM, Adam Badura wrote:
>>> Is it possible to lock a file with Boost.Filesystem to prevent its
>>> deletion, writing or reading?
>>>
>>
>> Against whom/what do you want to lock the file? On which platform?
>
> Against other processes will suffice I guess. On Windows platform,
> however using Boost.Filesystem I hope for (at least some) platform
> independence.

To clarify this. Your application is made up from several processes and
you want to implement locking between those or do you want to lock
against completely unrelated processes?

For the first case you can use boost.interprocess for the second case i
don't see a portable solution as for example POSIX systems are
implementing advisory locking (as opposed to mandatory locking on
Windows). On such system you can only have locking between cooperating
processes which are obeying to a locking protocol.

Frank


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net