The problem of creating a circular buffer in shared memory using Boost

I am trying to create a circular buffer in shared memory using Boost circular_buffer and Interprocess libraries. I compiled and ran the example in the Process Documentation to create a vector in shared memory without any problems. However, when I change it to use Boost round_buffer like:

 int main(int argc, char *argv[]) { managed_shared_memory segment(create_only, "MySharedMemory", 65536); const ShmemAllocator alloc_inst (segment.get_segment_manager()); MyCircBuffer *myCircBuf = segment.construct<MyCircBuffer>("MyCircBuffer")(alloc_inst); return 0; } 

I get a compilation error (called segment.construct() ). Any idea what I'm doing wrong? Is this because circular_buffer not one of the containers listed in /boost/interprocess/containers , i.e. is it incompatible with Interprocess?

Thanks,

C

+4
source share
1 answer

I asked the same question in the user forum, and it was suggested to use the -DBOOST_CB_DISABLE_DEBUG or -DNDEBUG flags, since circular_buffer uses the source pointers to support debugging.

Any other suggestions?

+3
source

Source: https://habr.com/ru/post/1302325/


All Articles