boost-interprocess

Shared map with boost::interprocess

可紊 提交于 2019-12-22 06:29:58
问题 I have a simple requirement that might be tough to solve. I did find some leads like this or this but I can't seem to readilly use them. The former doesn't even translate into buildable code for me. I am not experienced with Boost to just write this on my own but it seems to me this might be a common requirement. I have also come across Interprocess STL Map but I have not yet been able to assemble it into working code. I am thinking boost::interprocess is the way to go here, unless I want to

Does std::vector satisfy the container requirements for Boost.Interprocess allocators?

微笑、不失礼 提交于 2019-12-22 04:35:09
问题 In boost::interprocess documentation it is said as requirement for containers to be stored in shared memory: STL containers may not assume that memory allocated with an allocator can be deallocated with other allocators of the same type. All allocators objects must compare equal only if memory allocated with one object can be deallocated with the other one, and this can only tested with operator==() at run-time. Containers' internal pointers should be of the type allocator::pointer and

Allocating a user defined struct in shared memory with boost::interprocess

ε祈祈猫儿з 提交于 2019-12-21 21:40:23
问题 I am trying to use boost::interprocess to allocate a very simple data structure in shared memory but I cannot quite figure out how to use the boost interprocess allocators to perform the memory allocations/deallocations within the shared memory segment which I allocate as follows using namespace boost::interprocess; shared_memory_object::remove("MySharedMem"); mSharedMemory = std::make_unique<managed_shared_memory>( open_or_create, "MySharedMem", 65536); I previously asked a similar question

Interprocess reader/writer lock with Boost

匆匆过客 提交于 2019-12-21 04:27:14
问题 This thread is gold when it comes to explaining how to implement reader/writer locks with Boost. It seems relatively simple and I really love it but it also seems to be using a non-named lock and I need an interprocess solution (doesn't need to be portable, can be Windows-only). Is there a way to have an interprocess shared_mutex ? I see there is a named_mutex but I can't get it to work with shared_lock ot other locks. Any pointers are appreciated. [EDIT] In the meantime, I have come across

Synchronized stored procedure execution in mysql

强颜欢笑 提交于 2019-12-18 15:54:56
问题 I have a stored procedure in mysql thats to perform a task that needs to be synchronized such that if two application calls the stored procedure, only one can access a section of code to perform the task, keeping the other one to get blocked until the first one finishes the task. DELIMITER $$ CREATE PROCEDURE SP_GEN_ID(IN NAME VARCHAR(20)) BEGIN DECLARE maxLen int default 0; START TRANSACTION; #the section of code that needs to be synchronized COMMIT END; $$ DELIMITER ; So, if two

Read access violation for memory mapped vector in debug mode

回眸只為那壹抹淺笑 提交于 2019-12-13 12:22:48
问题 While attempting to use boost::interprocess for storing a std::vector in a memory mapped file, I am getting the exception Exception thrown: read access violation. when I try to push back on a loaded vector, but only in debug mode . This minimal example code (written by @sehe) is retrieved from https://stackoverflow.com/a/29602884/2741329, and it crashes on MSVC14 in debug mode and executed more than once: #include <boost/interprocess/managed_mapped_file.hpp> namespace bi = boost::interprocess

boost interprocess managed_mapped_file find failing

亡梦爱人 提交于 2019-12-13 02:27:57
问题 I am trying to share a structure across processes using interprocess in Boost. I've defined the mapped file to use null mutex because I was having problems with it locking and I don't mind doing the synchronisation myself. What I am having problems with though is finding of objects. I have the following declaration: typedef boost::interprocess::basic_managed_mapped_file < char, boost::interprocess::rbtree_best_fit<boost::interprocess::null_mutex_family,boost::interprocess::offset_ptr<void>>,

How to read/write vector<Chunk*> as memory mapped file(s)?

别说谁变了你拦得住时间么 提交于 2019-12-13 02:23:46
问题 I have a large set of data chunks (~50GB). In my code I have to be able to do the following things: Repeatedly iterate over all chunks and do some computations on them. Repeatedly iterate over all chunks and do some computations on them, where in each iteration the order of visited chunks is (as far as possible) randomized. So far, I have split the data into 10 binary files (created with boost::serialization ) and repeatedly read one after the other and perform the computations. For (2), I

Create a locked file with boost::interprocess::file_lock

丶灬走出姿态 提交于 2019-12-12 10:45:48
问题 I'd like to use boost::interprocess::file_lock to ensure that files that are written to a directory x by process P1 are not read by process P2 until they are complete. To do this, I'd like to have P1 lock the files with boost::interprocess::file_lock while it's writing them, and then unlock them when it's done. Then P2 can just skip over (and come back to) any files that are locked. The problem I'm having is that it appears that boost::interprocess::file_lock only lets you lock files that

Eigen fixed-size matrices in shared memory using boost interprocess

喜欢而已 提交于 2019-12-12 04:55:55
问题 I like to place Eigen fixed-size matrices into the shared memory. But on execution I am getting the following error: /usr/include/eigen3/Eigen/src/Core/DenseStorage.h:78: Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array() [with T = double; int Size = 2; int MatrixOrArrayOptions = 0]: Assertion `(reinterpret_cast<size_t>(eigen_unaligned_array_assert_workaround_gcc47(array)) & 0xf) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel