|
Boost : |
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2006-12-08 15:20:39
Hi Daren,
> Hi Ion,
>
> I mananged to get something working on Linux by doing a try-catch block on
> an "open_only" shmem object. It works fine on normal program exit. However, as
> you probably know, if the program is killed or crashed there is a dangling
> reference since remove/shm_unlink is never called.
>
> So I'm wondering:
> 1) is there any way around this behavior on a kill/crash?
I haven't found a solution. Interprocess' ancestor, Shmem, emulated
reference counted semantics in Linux trying to be similar to Windows,
but I couldn't manage crashes. So Interprocess took a different
approach: Linux persistence for Windows shared memory. Current
Interprocess persistence semantics are explained in the documentation here:
http://ice.prohosting.com/newfunk/boost/libs/interprocess/
doc/html/interprocess/some_basic_explanations.html
#interprocess.some_basic_explanations.persistence
> 2) is there a way to manually remove the shared memory besides rebooting? (i
> tried using ipcrm but it looks like it still thinks there are processes
> attached).
Memory is created using POSIX shm_open() so it's platform defined if the
shared memory is visible in the filesystem. In Linux, I think that
shared memory is created in /dev/shm. You can use shell's "rm
/dev/shm/file" to get the same behavior as shm_unlink().
If you find a way to manage crashes, I would be really, really happy. I
revised several portable run-time implementations (apache, cygwin,
etc...) but no-one, as far as I know has solved this.
Regards,
Ion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk