Jump to content
  • Advertisement
Sign in to follow this  
Prune

Linux shared memory question

This topic is 2505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Managed to answer my own question. Can't close both the name and the fd as the other process needs one or the other in order to open the shmem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!