lock data into RAM on Linux
This commit is contained in:
parent
94d4789e68
commit
7ceab5c88c
@ -38,6 +38,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <boost/interprocess/mapped_region.hpp>
|
#include <boost/interprocess/mapped_region.hpp>
|
||||||
#include <boost/interprocess/xsi_shared_memory.hpp>
|
#include <boost/interprocess/xsi_shared_memory.hpp>
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <sys/ipc.h>
|
||||||
|
#include <sys/shm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
@ -97,6 +102,7 @@ public:
|
|||||||
boost::interprocess::open_only,
|
boost::interprocess::open_only,
|
||||||
key
|
key
|
||||||
);
|
);
|
||||||
|
|
||||||
region = boost::interprocess::mapped_region (
|
region = boost::interprocess::mapped_region (
|
||||||
shm,
|
shm,
|
||||||
(
|
(
|
||||||
@ -115,6 +121,10 @@ public:
|
|||||||
key,
|
key,
|
||||||
size
|
size
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
shmctl(shm.get_shmid(), SHM_LOCK, 0);
|
||||||
|
#endif
|
||||||
region = boost::interprocess::mapped_region (
|
region = boost::interprocess::mapped_region (
|
||||||
shm,
|
shm,
|
||||||
boost::interprocess::read_write
|
boost::interprocess::read_write
|
||||||
|
Loading…
Reference in New Issue
Block a user