boost-interprocess

Sleep while holding a boost::interprocess::scoped_lock causes it to be never released

Hi, I'm doing IPC on Linux using boost::interprocess::shared_memory_object as per the reference (anonymous mutex example). There's a server process, which creates the shared_memory_object and writes to it, while holding an interprocess_mutex wrapped in a scoped_lock; and a client process which prints whatever the other one has written ...

How do I take ownership of an abandoned boost::interprocess::interprocess_mutex?

Hi, My scenario: one server and (some clients (though not many). The server can only respond to one client at a time, so they must be queued up. I'm using a mutex (boost::interprocess::interprocess_mutex) to do this, wrapped in a boost::interprocess::scoped_lock. The thing is, if one client dies unexpectedly (i.e. no destructor runs) ...

boost interprocess : shared memory and stl types

I have a simple struct : struct MyType { std::string name; std::string description; } and I'm putting it in a shared memory : managed_shared_memory sharedMemory(open_or_create, "name", 65535); MyType* pType = sharedMemory.construct<MyType>("myType")(); // ... setting pType members ... If the two applications communicating w...

shared memory, MPI and queuing systems

My unix/windows C++ app is already parallelized using MPI: the job is splitted in N cpus and each chunk is executed in parallel, quite efficient, very good speed scaling, the job is done right. But some of the data is repeated in each process, and for technical reasons this data cannot be easily splitted over MPI (...). For example: 5...

Shared memory and strings: managed?

I have a problem with boost::interprocess::string in shared memory. When I use a shared_memory_object I can manipulate a structure with different fields, BUT strings (I get a segmentation fault). On the other side, when I use managed_shared_memory everything is fine. Am I doing something wrong? Do you know if there is a performance...

Boost interprocess anonymous condition timed_wait not compilable

Hi... I'm wondering what I'm doing wrong... with a sole wait it compiles and runs, but not with a timed_wait: using boost::interprocess::scoped_lock; using boost::interprocess::interprocess_mutex; using boost::posix_time::milliseconds; [...] scoped_lock<interprocess_mutex> lock(obj->mutex); while (...) { obj->condition.timed_wait(...

Problem creating a circular buffer in shared memory using Boost

Hi, I am trying to create a circular buffer in shared memory using Boost circular_buffer and Interprocess libraries. I compiled and ran the the example given in the Interprocess documentation for creating a vector in shared memory with no problem. However, when I modify it to use the Boost circular_buffer as: int main(int argc, char *...

problem with memcpy'ing from shared memory in boost.interprocess

This is driving me wild with frustration. I am just trying to create a shared memory buffer class that uses in shared memory created through Boost.Interprocess where I can read/store data. I wrote the following to test the functionality #include <boost/interprocess/shared_memory_object.hpp> #include <boost/interprocess/mapped_region.hpp...

Why is creating a ring buffer shared by different processes so hard (in C++), what I am doing wrong?

I am being especially dense about this but it seems I'm missing an important, basic point or something, since what I want to do should be common: I need to create a fixed-size ring buffer object from a manager process (Process M). This object has write() and read() methods to write/read from the buffer. The read/write methods will be ca...

Instantiating class with custom allocator in shared memory

I'm pulling my hair due to the following problem: I am following the example given in boost.interprocess documentation to instantiate a fixed-size ring buffer buffer class that I wrote in shared memory. The skeleton constructor for my class is: template<typename ItemType, class Allocator > SharedMemoryBuffer<ItemType, Allocator>::Shared...

How to pass parameters to manage_shared_memory.construct() in Boost.Interprocess

I've stared at the Boost.Interprocess documentation for hours but still haven't been able to figure this out. In the doc, they have an example of creating a vector in shared memory like so: //Define an STL compatible allocator of ints that allocates from the managed_shared_memory. //This allocator will allow placing containers in the se...

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

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 mem...

Boost.MultiIndex: Are there way to share object between two processes?

Hello, I have a Boost.MultiIndex big array about 10Gb. In order to reduce the reading I thought there should be a way to keep the data in the memory and another client programs will be able to read and analyse it. What is the proper way to organize it? The array looks like: struct particleID { int ID;// real...

C++ allocators, specifically passing constructor arguments to objects allocated with boost::interprocess::cached_adaptive_pool

This is an embarrassing question, but even the well-written documentation provided with boost.interprocess hasn't been enough for me to figure out how to do this. What I have is a cached_adaptive_pool allocator instance, and I want to use it to construct an object, passing along constructor parameters: struct Test { Test(float argume...

Boost::Interprocess Container Container Resizing No Default Constructor

Hi, After combing through the Boost::Interprocess documentation and Google searches, I think I've found the reason/workaround to my issue. Everything I've found, as I understand it, seems to be hinting at this, but doesn't come out and say "do this because...". But if anyone can verify this I would appreciate it. I'm writing a series...

boost::interprocess::message_queue stops working in Release mode with visual C++

I am using boost::interprocess::message_queue, with VC++ (in Microsoft Visual Studio 2005). It is working properly in Debug mode. Then when I compile my program in Release mode it stops working, every time I call "try_send" it returns false. I don't understand what could be the settings that are different between Release and Debug mode, ...

Boost::Interprocess Shared Memory Bus Error

Hi, I'm using CentOS 5.4 x86_64 and Boost 1.42.0 on a cluster that uses Open-MPI 1.3.3. I'm writing a shared library that uses shared memory to store large amounts of data for multiple processes to use. There's also a loader application that will read in the data from the files and load them into the shared memory. When I run the l...

Is boost::interprocess ready for prime time?

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....

C++ BOOST: windows shared memory get_size() returns zero

The below is from the official BOOST docs. Why do I always get size of zero when calling region.get_size() ? What am I doing wrong? int main(int argc, char *argv[]) { //Create a native windows shared memory object. windows_shared_memory shm (create_only, "MySharedMemory", read_write, 1000); //Map the whole shared memory in this ...

Boost::Interprocess with complex, nested classes

I think I finally have a grasp on the basics of the boost:interprocess library, and I've been using it successfully when dealing with relatively simple classes that contain a few member variables that are all standard data types. However, I am now faced with the problem of pushing a rather complex class out into interprocess shared memo...