Keeping a single instance of an applicaton
Hey guys, I am wondering what's the proper and cross platform (if possible) way to keep a single instance of an application, with some additional IPC (like making the already running app visible if it's being ran again). Does anyone have any advice? Thanks in advance
Normally QSharedMemory or QLocalServer is used.
However, its a pretty common requirement so
maybe this could work for you ?
@mrjj Hey there, thanks for responding! My concern with any of these methods is an edge case (such as an application crash, or even system crash), leading to improper cleanup and because of that failure to restart the application later, especially on Windows. Looking through the implementation of SingleApplication it does not seem like it handles such situations on Windows. On Unix it makes handlers for many signals to clean up the shared memory, but there seems to be no analogue for that on Windows. Does Windows handle shared memory differently?
Did you also check the QSingleApplication from the Qt solutions ?
@SGaist I have not, as I thought the project is unmaintaned and unsupported. I'll check out that implementation too since you're bringing it up though. Thanks