Donald Backstrom <donaldb@cstgroup.com.au> wrote:
Agreed, but there are instances where that is not sufficient. We have similar
requirements, but we need to ensure that the same GUI is only run once on a
network of QNX nodes (or on one client when a server has multiple Phindows
sessions). We have found that the registering a global name is the only
foolproof mechanism. I have a nagging doubt about using the file-opening plan
with what happens when the app crashes (or its node goes away, or there is a
power failure etc) and leaves the file open or lying around. The pwlock file
in QNX4 occasionally has this problem as well.
Registering a global name isn’t foolproof either. If your network gets
“seperated” you could have two applications do so successfully, and even
without that happening, if there are delays in updates, or the two registers
are “simultaneous” enough, both could be told they successfully registered
the global name.
Yes, having a file around could be a problem too – it isn’t a perfect
solution. Of course, if using the file method, the process could put its
pid & nid in the file – then if someone fails the O_CREAT|O_EXCL, they
can do an open for O_RDONLY, read the nid&pid, and try to verify that the
process is still alive, allowing dynamic clean-up for the process death
option.
-David
How do I prevent multiple instances of an app from running
simultaneously? The touchscreen we’re using is very sensitive and often
opens two apps when someone clicks on the program icon. Would I check
the link_instance parameter and save it in a global variable? I looked
in the QDN, but all it says is that multiple instances are not
supported, not how to prevent it.
Thanks,
Meredith Dill
mdill@aseco.com
–
QNX Training Services
dagibbs@qnx.com