ajay.lele
August 14th, 2009, 08:00 PM
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/library/aa366556(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
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/library/aa366556(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