Subject: Re: [boost] Control of the file location for the boost::interprocess::managed_shared_memory object
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-08-11 13:17:19
Michael Watkins escribió:
>>> Is it possible to control the exact location of the file that is backing the shared memory created by boost::interprocess::managed_shared_memory?
>>> The issue occurs under Windows (it has not been tried yet under Linux). The problem is two processes attempting to connect to the same shared memory segment between two accounts, in specific from a program running as a service (using the system account) and a program running under a user account. The user account is running a program that needs to interface to the database that the service created.
>>> Everything seems to work fine, but the service will open the shared memory backing file in the global temp directory while the user account will open the file in their local settings temporary directory. Therefore two different segments are opened.
>>> The interim solution is to use boost::interprocess::managed_windows_shared_memory to create the shared memory, but the desire is to use the generic version for cross-platform compatibility. If the full file path could be specified when creating the memory segment, it would solve the problem.
Soon to be released Boost 1.40 uses All Users Documents and Settings
folder to build shared memory so that should work both for services and
Adding configurability for the path would also be a good idea, maybe
using an environment variable?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk