Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-07-27 14:53:13


Mark A. Thalman wrote:
> We are using the boost interprocess library for some cross-platform
> interprocess communication. It seems to be working fine on Windows
> but we are having some issues on the Mac OS (10.4.10, using gcc 4).
>
> One thing is that the remove call always deletes the shared memory
> file, regardless of whether the other process is using it. Does
> anyone know if this has been tested?

This behavior is correct. Shared memory deletion is the same as
"std::remove". In UNIX systems, this calls "unlink" and deletes the file
in use from the filesystem but attached processes continue working with
the deleted file. The documentation says:

(http://igaztanaga.drivehq.com/interprocess/interprocess/sharedmemory.html)

"The remove operation *might* fail returning false if the shared memory
does not exist, the file is open or the file is still memory mapped by
other processes"

Note that it says "might" instead of "will". But I agree that I should
add more explanations to the function to note the differences between
Windows and Unix. I'm afraid that I won't find a portable implementation
for "erase". Note that this behavior also happens with the standard C
function std::remove() that deletes a file. The unix version calls
"unlink" and always deletes the file from the filesystem. The windows
version fails if the file is in use. Annoying, I know, but I haven't
found a better solution :-(

> Also, the only version I can find is in CVS. Is this where I should
> be getting the source from, or is there an "official" release somewhere?

The official release is CVS until Interprocess is released in Boost 1.35.

Regards,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk