Take care which mecanism you use here, this get really annoying with some crashing application (not only they crash, but to refuse to launch again).
To avoid this, simply use a pid file and check if the pid process still run, give option to your user to kill the previous instance of the program (in case the process is hook or is zombie). If the pid process does not exist, assume none is launch and put your pid into the file.This way you don't get your user mad and control the number of instance. Take care, if you want to allow application to run 1x/machine or 1x/user connected. The 1x/user will require to either create the pid file into the user home directory or use the user identifier into the pid file. Jerome On Fri, Apr 22, 2016 at 3:11 PM, Nye <kshegu...@gmail.com> wrote: > Hello, > This is ordinarily done with the help of a global locking primitive (for > example a global mutex). On the first run the mutex would be locked, and if > locking fails on the second one, you just exit the application. > IMPORTANT: As any global resource, special care should be taken to release > it in case of expected or unexpected program shutdown. > > As for a Qt-way of doing this, you could try QSystemSemaphore ( > http://doc.qt.io/qt-5/qsystemsemaphore.html). > > Kind regards. > > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest