aboutsummaryrefslogtreecommitdiff
path: root/singleapplication.h
diff options
context:
space:
mode:
authorChristoph Cullmann <christoph@cullmann.io>2022-04-05 22:46:42 +0200
committerGitHub <noreply@github.com>2022-04-05 23:46:42 +0300
commit611e48abbbcaea7e59352c277db0ca2c24369eb8 (patch)
treeaf45f4ddced1b25c125ce2a440a830c8fe9dcef0 /singleapplication.h
parentMerge pull request #153 from itay-grudev/lts-only (diff)
downloadsingleapplication-611e48abbbcaea7e59352c277db0ca2c24369eb8.tar.xz
Provide API for blocking sendMessage (#154)
Diffstat (limited to 'singleapplication.h')
-rw-r--r--singleapplication.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/singleapplication.h b/singleapplication.h
index 91cabf9..5565bb8 100644
--- a/singleapplication.h
+++ b/singleapplication.h
@@ -125,13 +125,23 @@ public:
QString currentUser() const;
/**
+ * @brief Mode of operation of sendMessage.
+ * @enum
+ */
+ enum SendMode {
+ NonBlocking, /** Do not wait for the primary instance termination and return immediately */
+ BlockUntilPrimaryExit, /** Wait until the primary instance is terminated */
+ };
+
+ /**
* @brief Sends a message to the primary instance. Returns true on success.
* @param {int} timeout - Timeout for connecting
+ * @param {SendMode} sendMode - Mode of operation.
* @returns {bool}
* @note sendMessage() will return false if invoked from the primary
* instance.
*/
- bool sendMessage( const QByteArray &message, int timeout = 100 );
+ bool sendMessage( const QByteArray &message, int timeout = 100, SendMode sendMode = NonBlocking );
/**
* @brief Get the set user data.