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
This commit is contained in:
Ingo Klöcker 2020-10-21 18:03:46 +02:00
parent ff23e24063
commit 74c8131d80
3 changed files with 7 additions and 0 deletions

1
NEWS
View File

@ -22,6 +22,7 @@ Noteworthy changes in version 1.14.1 (unreleased)
cpp: EngineInfo::Version::operator!= NEW. cpp: EngineInfo::Version::operator!= NEW.
cpp: StatusConsumer NEW. cpp: StatusConsumer NEW.
cpp: StatusConsumerAssuanTransaction NEW. cpp: StatusConsumerAssuanTransaction NEW.
cpp: Context::cancelPendingOperationImmediately NEW.
qt: operator<<(QDebug debug, const GpgME::Error &err) NEW. qt: operator<<(QDebug debug, const GpgME::Error &err) NEW.

View File

@ -1343,6 +1343,11 @@ Error Context::cancelPendingOperation()
return Error(gpgme_cancel_async(d->ctx)); return Error(gpgme_cancel_async(d->ctx));
} }
Error Context::cancelPendingOperationImmediately()
{
return Error(gpgme_cancel(d->ctx));
}
bool Context::poll() bool Context::poll()
{ {
gpgme_error_t e = GPG_ERR_NO_ERROR; gpgme_error_t e = GPG_ERR_NO_ERROR;

View File

@ -484,6 +484,7 @@ public:
GpgME::Error wait(); GpgME::Error wait();
GpgME::Error lastError() const; GpgME::Error lastError() const;
GpgME::Error cancelPendingOperation(); GpgME::Error cancelPendingOperation();
GpgME::Error cancelPendingOperationImmediately();
class Private; class Private;
const Private *impl() const const Private *impl() const