|
-
August 14th, 2009, 08:00 PM
#1
Retaining file mapping object after process exit
Hi,
I am writing a small library using Win32 APIs and it needs to provide Linux like shared memory support. Trying to use file mapping objects backed by system paging file
http://msdn.microsoft.com/en-us/libr...56(VS.85).aspx
Problem is even if the process does not explicitly close the handler to mapped object, it is destroyed when the process exists (guess Windows decrements the handle refcount when process exists and since it reaches 0, mapped object is destroyed). So another process which might start after the 1st process exited would not be able to see the mapped object. This behaviour is different from Linux implementation wherein the shared memory is not destroyed until shm_unlink is done explicitly. Is there a way to not have the file mapping object to be destroyed when the process exists (and no other handle to it is open from another process)
Thanks in advance
Regards
-
August 14th, 2009, 08:51 PM
#2
Re: Retaining file mapping object after process exit
>> Trying to use file mapping objects backed by system paging file
It needs to be "backed" by a real file if you want it to persist while no processes have a handle open to it.
gg
-
August 17th, 2009, 03:22 PM
#3
Re: Retaining file mapping object after process exit
Okay. Thanks. Will implement it using disk files.
-
August 18th, 2009, 09:36 AM
#4
Re: Retaining file mapping object after process exit
I like the fact that Windows does it both ways. In the cases where you don't need the persistent behavior, the page file backing is sure handy because you don't need to worry about cleaning up the file when you are done.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|