[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/8] Add API for thread cancellation

From: "Daniel P. Berrange" <berrange redhat com>

Add a virThreadCancel function. This functional is inherantly
dangerous and not something we want to use in general, but
integration with SELinux requires that we provide this stub.
We leave out any Win32 impl to discourage further use and
because obviously SELinux isn't enabled on Win32

Signed-off-by: Daniel P. Berrange <berrange redhat com>
 src/libvirt_private.syms    | 1 +
 src/util/virthread.h        | 1 +
 src/util/virthreadpthread.c | 5 +++++
 3 files changed, 7 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ed46479..acaa4d7 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1743,6 +1743,7 @@ virMutexInitRecursive;
diff --git a/src/util/virthread.h b/src/util/virthread.h
index c59a2cf..3b11dca 100644
--- a/src/util/virthread.h
+++ b/src/util/virthread.h
@@ -54,6 +54,7 @@ int virThreadCreate(virThreadPtr thread,
 void virThreadSelf(virThreadPtr thread);
 bool virThreadIsSelf(virThreadPtr thread);
 void virThreadJoin(virThreadPtr thread);
+void virThreadCancel(virThreadPtr thread);
 /* These next two functions are for debugging only, since they are not
  * guaranteed to give unique values for distinct threads on all
diff --git a/src/util/virthreadpthread.c b/src/util/virthreadpthread.c
index 9f02ba1..b42b333 100644
--- a/src/util/virthreadpthread.c
+++ b/src/util/virthreadpthread.c
@@ -236,6 +236,11 @@ void virThreadJoin(virThreadPtr thread)
     pthread_join(thread->thread, NULL);
+void virThreadCancel(virThreadPtr thread)
+    pthread_cancel(thread->thread);
 int virThreadLocalInit(virThreadLocalPtr l,
                        virThreadLocalCleanup c)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]