Sign in to follow this  
Prune

Linux shared memory question

Recommended Posts

Prune    224
Regarding shm_unlink(), I see the following description:
"the removal of the memory object contents shall be postponed until all open and map references to the shared memory object have been removed."

Does this mean I can call close() and shm_unlink() immediately after mmap() and then know that the shared memory will still be there until I call munmap()? This way, in a RAII object I'd not need to store the fd and/or name in members for the dtor, and I'd only need the pointer?

That is, is this valid:
ctor: shm_open(), ftruncate(), mmap(), close(), shm_unlink()
dtor: munmap()

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this