Boost logo

Boost Users :

Subject: Re: [Boost-users] File-system persistence for boost shared memory files
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2012-04-05 05:00:22


El 05/04/2012 10:14, Rajalakshmi Iyer escribió:
> Hello,
>
> The boost documentation suggests that shared memory interprocess
> mechanism can have file-system or kernel persistence.
>
> When I create shared memory files on an Ubuntu Linux host, they are
> created at /var/run/shm. But on a system reboot, the shared memory files
> go away, which means they are using kernel persistence.
>
> How can I ensure that shared memory files persist across reboots?

You can't, as the OS chooses that. Can't you use memory mapped files?
Those are portable and have well-known semantics..

For systems without POSIX support interprocess uses memory mapped files
in a temp directory. If you disable POSIX shm detection undefining

BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS

in boost/interprocess/detail/workaround.hpp

then you get shared memory emulation using memory mapped files.

Ion


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