boost::interprocess on FreeBSD 7

My apologies if this is a resend. I think I might have sent the first time before I was approved in the list. Using boost::interprocess from boost_1_37_0 on FreeBSD 7.0, specifically wishing to allocate boost::interprocess::map structures in shared memory pools. I get a segmentation fault in pthread_mutex_lock() from /lib/libthr.so. 3, in a variety of places including anything related to a ShmemAllocator. For example, when I run the example from http://www.boost.org/doc/libs/1_37_0/doc/html/interprocess/allocators_contai... I get the segfault at this line: //Initialize the STL-like allocator const ShmemAllocator alloc_inst (segment.get_segment_manager()); I encountered this segfault (always in pthread_mutex_lock) when trying to use mapped file boost::interprocess::map structure that works very well on darwin. Can anyone suggest what I might do to get this working on FreeBSD? Is anyone familiar with FreeBSD 7.0 and the scary inner workings of boost::interprocess interested in a small consulting project? ----------------------------------------------------------------------------------------------- FWIW, here is the complete text of the example, taken verbatim from the tutorial page: void test_ipc2() { using namespace boost::interprocess; shared_memory_object::remove("MySharedMemory"); try{ //A managed shared memory where we can construct objects //associated with a c-string managed_shared_memory segment(create_only, "MySharedMemory", //segment name 65536); //Alias an STL-like allocator of ints that allocates ints from the segment typedef allocator<int, managed_shared_memory::segment_manager> ShmemAllocator; //Alias a vector that uses the previous STL-like allocator typedef vector<int, ShmemAllocator> MyVector; int initVal[] = {0, 1, 2, 3, 4, 5, 6 }; const int *begVal = initVal; const int *endVal = initVal + sizeof(initVal)/sizeof(initVal[0]); //Initialize the STL-like allocator const ShmemAllocator alloc_inst (segment.get_segment_manager()); //Construct the vector in the shared memory segment with the STL- like allocator //from a range of iterators MyVector *myvector = segment.construct<MyVector> ("MyVector")/*object name*/ (begVal /*first ctor parameter*/, endVal /*second ctor parameter*/, alloc_inst /*third ctor parameter*/); BOOST_CHECK(myvector); //Use vector as your want std::sort(myvector->rbegin(), myvector->rend()); // . . . //When done, destroy and delete vector from the segment segment.destroy<MyVector>("MyVector"); } catch(...){ shared_memory_object::remove("MySharedMemory"); throw; } shared_memory_object::remove("MySharedMemory"); }
participants (1)
-
Andy Wiese