|
Boost Users : |
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2006-09-15 10:07:36
Hi,
> Can anybody tell me how can I make the shared memory segment (together
> with the objects constructed in it) remain in memory AFTER the process
> which created it terminates?
Sadly, Shmem is based on Windows shared memory lifetime, that is,
process-lifetime. With this lifetime, when the last process attached to
a shared memory is detaches the memory, the shared memory is destroyed.
There is chance to maintain the memory in Shmem.
On the other hand, Boost.Interprocess, the official Boost library based
on Shmem, has changed shared memory lifetime to POSIX lifetime (kernel
or filesystem) so you must explicitly destroy the shared memory (using
shared_memory_object::unlink()). So you can use Boost.Interprocess to
achieve shared memory persistence.
Current Boost.Interprocess snapshot is in Boost CVS and
Boost.Vault/Concurrent Programming. It has several changes requested in
Shmem review, but in general it should be easy to port your application
to Boost.Interprocess.
Regards,
Ion
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net