[Pkg-privacy-commits] [libgsecuredelete] 55/168: Add ability to cancel the operations
Ulrike Uhlig
u-guest at moszumanska.debian.org
Thu Jul 7 20:06:39 UTC 2016
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to branch master
in repository libgsecuredelete.
commit e46a043bdb60b9169273ab735dd36a473a0cc913
Author: Colomban Wendling <ban at herbesfolles.org>
Date: Tue Feb 23 22:44:01 2010 +0100
Add ability to cancel the operations
Add AsyncOperation.cancel() to cancel a running operation.
---
gsecuredelete/async-operation.vala | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/gsecuredelete/async-operation.vala b/gsecuredelete/async-operation.vala
index 430d7d3..cae984e 100644
--- a/gsecuredelete/async-operation.vala
+++ b/gsecuredelete/async-operation.vala
@@ -320,6 +320,24 @@ namespace Gsd
return ! finished;
}
+ /** cancel:
+ * Tries to cancel the operation.
+ *
+ * Returns: %true if successfully canceled, %false otherwise.
+ */
+ public bool cancel ()
+ requires (this.busy)
+ {
+ int kill_status;
+
+ kill_status = Posix.kill ((Posix.pid_t)this.pid, ProcessSignal.TERM);
+ if (kill_status < 0) {
+ critical ("kill() failed: %s", strerror (errno));
+ }
+
+ return ! (kill_status < 0);
+ }
+
/** run:
* @working_directory: the working directory of the child process, or null
* to use the parent's one.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libgsecuredelete.git
More information about the Pkg-privacy-commits
mailing list