Boost logo

Boost Users :

Subject: Re: [Boost-users] Using boost interprocess file_lock.timed_lock
From: Bill Moo (cppsysdev_at_[hidden])
Date: 2011-07-30 09:53:49


2011/7/30 Ion Gaztañaga <igaztanaga_at_[hidden]>

> El 30/07/2011 9:58, Bill Moo escribió:
>
>> On Fri, Jul 29, 2011 at 8:42 AM, <Viatcheslav.Sysoltsev_at_h-d-**gmbh.de<Viatcheslav.Sysoltsev_at_[hidden]>
>> <mailto:Viatcheslav.Sysoltsev@**h-d-gmbh.de<Viatcheslav.Sysoltsev_at_[hidden]>>>
>> wrote:
>>
>
> This is a Boost.Interprocess bug that I don't think it can be easily
> solved. Once you lock a file in Windows, you can only write to it through
> the handle (internal to fileLock) used to lock it. That's why the handle
> inside "os" is blocked. I should note this in the documentation as file
> locking can only be used portably in Interprocess to control access to
> ANOTHER file (or resource) but not to limit access to the same file you've
> just locked. From MSDN:
>
> http://msdn.microsoft.com/en-**us/library/aa365203%28v=vs.85%**29.aspx>
>
> "Locking a region of a file is used to acquire shared or exclusive access
> to the specified region using this file handle. If the file handle is
> inherited by a process created by the locking process, the child process is
> not granted access to the locked region. If the locking process opens the
> file a second time, it cannot access the specified region through this
> second handle until it unlocks the region."
>
> Best,
>
>

Hi Ion,

Ah! It wasn't me I'm glad to hear that, and thank you very much for the
informative reply. I will just have to think of another approach to this.

Thank you again for your time.

-- 
Bill


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