]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Add API for thread cancellation
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 23 Jan 2012 14:58:13 +0000 (14:58 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 12 Mar 2013 18:07:11 +0000 (18:07 +0000)
Add a virThreadCancel function. This functional is inherently
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
src/util/virthread.h
src/util/virthreadpthread.c

index 599b71edd38570d07e54997d69ded88eb574617a..8fe0b97a4f2725886a9884d0caeca80effb39697 100644 (file)
@@ -1744,6 +1744,7 @@ virMutexInitRecursive;
 virMutexLock;
 virMutexUnlock;
 virOnce;
+virThreadCancel;
 virThreadCreate;
 virThreadID;
 virThreadInitialize;
index c59a2cfddf77ff6d25a0629f16716bd4367f5ba4..ca1306a8ab9aaca02fc53de63770d445b2a85ebf 100644 (file)
@@ -55,6 +55,10 @@ void virThreadSelf(virThreadPtr thread);
 bool virThreadIsSelf(virThreadPtr thread);
 void virThreadJoin(virThreadPtr thread);
 
+/* This API is *NOT* for general use. It exists solely as a stub
+ * for integration with libselinux AVC callbacks */
+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
  * architectures, nor are the two functions guaranteed to give the same
index 9f02ba1b04a7e6b7035e79a2d60ed950d7521ef9..b42b333853daca8e1a063da10f872b1477f770ed 100644 (file)
@@ -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)
 {