[Qt-interest] A couple of Issues in Qt Application
jjDaNiMoTh
jjdanimoth at gmail.com
Thu Oct 29 23:03:36 CET 2009
2009/10/29 Raja Rokkam <rokkamraja at gmail.com>:
> Hi All,
>
> 1.) I am trying to implement QSharedMemory to prevent running multiple
> instance of my application. The code works fine in WIndows but in Unix it
> works fine as long as there is no crash. If there is a crash the
> QSharedMemory survives the crash and so later no instance is spawned until
> PC is rebooted.
> Is there any solution for this issue or any other simpler and cleaner
> solution ?
I think there's no solution for the issue; it's the UNIX design.
If we look at the standard POSIX, if you open a segment of shared
memory (shm_open), you need explicity to unlink it (shm_unlink),
otherwise it will live until reboot ( and, if you think about it, it
makes sense ).
So, if your code works fine, try to don't have crashes.
If it crashes, use ipcs (on linux/os x) and see if you can force a delete.
HTH
More information about the Qt-interest-old
mailing list