Last active
August 29, 2015 13:59
-
-
Save polovik/10714135 to your computer and use it in GitHub Desktop.
Verify unique instance of application in Qt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QSharedMemory> | |
int main(int argc, char *argv[]) | |
{ | |
// Verify unique instance of application | |
QSharedMemory sharedMemory("service"); | |
if (sharedMemory.attach()) | |
return EXIT_FAILURE; | |
if (!sharedMemory.create(1)) | |
return EXIT_FAILURE; | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment