From 74c8131d809be49d64f482961fee1e6e0dbe4f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Wed, 21 Oct 2020 18:03:46 +0200 Subject: [PATCH] cpp: Add support for gpgme_cancel * lang/cpp/src/context.cpp, lang/cpp/context.h (Context::cancelPendingOperationImmediately): New. * NEWS: Mention added API -- This allows immediate canceling of running operations, e.g. when a thread with a long running operation (like SCD DEVINFO --watch) is going to be terminated (on application shutdown). GnuPG-bug-id: 5066 --- NEWS | 1 + lang/cpp/src/context.cpp | 5 +++++ lang/cpp/src/context.h | 1 + 3 files changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 96520552..98cbc40a 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,7 @@ Noteworthy changes in version 1.14.1 (unreleased) cpp: EngineInfo::Version::operator!= NEW. cpp: StatusConsumer NEW. cpp: StatusConsumerAssuanTransaction NEW. + cpp: Context::cancelPendingOperationImmediately NEW. qt: operator<<(QDebug debug, const GpgME::Error &err) NEW. diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp index 6dd6b6db..e868d387 100644 --- a/lang/cpp/src/context.cpp +++ b/lang/cpp/src/context.cpp @@ -1343,6 +1343,11 @@ Error Context::cancelPendingOperation() return Error(gpgme_cancel_async(d->ctx)); } +Error Context::cancelPendingOperationImmediately() +{ + return Error(gpgme_cancel(d->ctx)); +} + bool Context::poll() { gpgme_error_t e = GPG_ERR_NO_ERROR; diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h index 9cd35a5c..4021aa97 100644 --- a/lang/cpp/src/context.h +++ b/lang/cpp/src/context.h @@ -484,6 +484,7 @@ public: GpgME::Error wait(); GpgME::Error lastError() const; GpgME::Error cancelPendingOperation(); + GpgME::Error cancelPendingOperationImmediately(); class Private; const Private *impl() const