#include #include #include int main( int argc, const char* argv[]) { boost::interprocess::shared_memory_object::remove( "MySharedMemory"); boost::interprocess::managed_shared_memory segment( boost::interprocess::create_only, "MySharedMemory", 4096); pid_t child = fork(); printf( "%s pthread_self %ld\n", child? "parent": "child", pthread_self()); for( int i = 0; i < 1000000; ++i) int *myclass = segment.find< int>( "aaa").first; printf( "Done %s\n", child? "parent": "child"); if( 0 == child) return 0; wait( NULL); printf( "All Done\n"); }