boost-interprocess

Is boost::interprocess ready for prime time? [closed]

人走茶凉 提交于 2019-12-04 10:26:39
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I was working on a thread safe queue backed by memory mapped files which utilized boost interprocess fairly heavily. I submitted it for code review and a developer with more years of experience than I have on

Mapping non-contiguous blocks from a file into contiguous memory addresses

ε祈祈猫儿з 提交于 2019-12-04 00:22:46
I am interested in the prospect of using memory mapped IO, preferably exploiting the facilities in boost::interprocess for cross-platform support, to map non-contiguous system-page-size blocks in a file into a contiguous address space in memory. A simplified concrete scenario: I've a number of 'plain-old-data' structures, each of a fixed length (less than the system page size.) These structures are concatenated into a (very long) stream with the type & location of structures determined by the values of those structures that proceed them in the stream. I'm aiming to minimize latency and

Is it possible to store polymorphic class in shared memory?

牧云@^-^@ 提交于 2019-12-03 13:41:05
问题 Suppose I have class Base and Derived : public Base . I have constructed a shared memory segment using boost::interprocess library. Is it possible to have code similar to this: Base* b = new Derived(); write(b); //one app writes Base* b2 = read(b); //second app reads //b equals b2 (bitwise, not the ptr location) The problems I see here is for instance that the required space for a derived class of Base is unknown (so how much shmem to allocate?) Q : how to pass objects via pointers between

Is there a difference between boost iostream mapped file and boost interprocess mapped file?

醉酒当歌 提交于 2019-12-03 11:58:37
问题 I want to create a mapped binary file into memory; however I am not sure how to create the file to be mapped into the system. I read the documentation several times and realize there are 2 mapped file implementations, one in iostream and the other in interprocess. Do you guys have any idea on how to create a mapped file into shared memory? I am trying to allow a multi-threaded program to read an array of large double written in a binary file format. Also what is the difference between the

What does boost interprocess file_lock actually do with the target file?

∥☆過路亽.° 提交于 2019-12-03 08:55:53
I've done some reading about boost::interprocess::file_lock and it seems to do pretty much what I'm after (support shareable and exclusive locking, and being unlocked if the process crashes or exits). One thing I'm not sure about though, is what does it do to the file? Can I use for example a file of 0 bytes long? Does boost::interprocess write anything into it? Or is its presence all the system cares about? I've been using boost::interprocess now for some time to reliably memory map a file and write into it, now I need to go multiprocess and ensure that reads and writes to this file are

Is boost::interprocess ready for prime time? [closed]

孤街浪徒 提交于 2019-12-03 05:47:18
I was working on a thread safe queue backed by memory mapped files which utilized boost interprocess fairly heavily. I submitted it for code review and a developer with more years of experience than I have on this planet said he didn't feel that boost::interprocess was "ready for prime time" and that I should just use pthreads directly. I think that's mostly FUD. I personally think it's beyond ridiculous to go about reimplementing things such as upgradable_named_mutex or boost::interprocess::deque, but I'm curious to know what other people think. I couldn't find any data to back up his claim,

Is there a difference between boost iostream mapped file and boost interprocess mapped file?

故事扮演 提交于 2019-12-03 02:28:28
I want to create a mapped binary file into memory; however I am not sure how to create the file to be mapped into the system. I read the documentation several times and realize there are 2 mapped file implementations, one in iostream and the other in interprocess. Do you guys have any idea on how to create a mapped file into shared memory? I am trying to allow a multi-threaded program to read an array of large double written in a binary file format. Also what is the difference between the mapped file in iostream and interprocess? Joe D As far as I can tell, iostreams will place the mapped file

boost::named_mutex: Safely cleaning up when last process closes

走远了吗. 提交于 2019-12-02 08:20:34
问题 I have a resource which I need to protect access to within a process, and across multiple processes. I've managed this by creating a named mutex via boost::interprocess:named_recursive_mutex , and it works great. #include <boost/interprocess/sync/named_recursive_mutex.hpp> boost::interprocess::named_recursive_mutex mut( boost::interprocess::open_or_create, "MY_SHARED_MUTEX_123"); However, it's to my understanding that this should be cleaned up eventually via remove() , ie: mut.remove("MY

boost::named_mutex: Safely cleaning up when last process closes

对着背影说爱祢 提交于 2019-12-02 05:07:14
I have a resource which I need to protect access to within a process, and across multiple processes. I've managed this by creating a named mutex via boost::interprocess:named_recursive_mutex , and it works great. #include <boost/interprocess/sync/named_recursive_mutex.hpp> boost::interprocess::named_recursive_mutex mut( boost::interprocess::open_or_create, "MY_SHARED_MUTEX_123"); However, it's to my understanding that this should be cleaned up eventually via remove() , ie: mut.remove("MY_SHARED_MUTEX"); However, this call appears to completely clobber the mutex, rather than check/decrement a

boost named_condition is not waking up waiting process

梦想的初衷 提交于 2019-12-01 14:43:54
I have 2 processes (producer and consumer) sharing an int deque in shared memory, I have the producer process put 2 numbers in the deque and then it gets in a wait state losing its mutex lock. I then have the consumer process removing the numbers and printing them. It then does a notify on the condition which the producer is waiting on. The consumer then goes on its own wait on a second condition. After this case the producer does not wake up. I am using the same mutex between the processes. Please find all code below. Include file shared_memory.h: #ifndef SharedMemory_h #define SharedMemory_h