提交 a2997142 编写于 作者: D Daniel P. Berrange

Add API for thread cancellation

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: NDaniel P. Berrange <berrange@redhat.com>
上级 32b7e92d
...@@ -1744,6 +1744,7 @@ virMutexInitRecursive; ...@@ -1744,6 +1744,7 @@ virMutexInitRecursive;
virMutexLock; virMutexLock;
virMutexUnlock; virMutexUnlock;
virOnce; virOnce;
virThreadCancel;
virThreadCreate; virThreadCreate;
virThreadID; virThreadID;
virThreadInitialize; virThreadInitialize;
......
...@@ -55,6 +55,10 @@ void virThreadSelf(virThreadPtr thread); ...@@ -55,6 +55,10 @@ void virThreadSelf(virThreadPtr thread);
bool virThreadIsSelf(virThreadPtr thread); bool virThreadIsSelf(virThreadPtr thread);
void virThreadJoin(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 /* These next two functions are for debugging only, since they are not
* guaranteed to give unique values for distinct threads on all * guaranteed to give unique values for distinct threads on all
* architectures, nor are the two functions guaranteed to give the same * architectures, nor are the two functions guaranteed to give the same
......
...@@ -236,6 +236,11 @@ void virThreadJoin(virThreadPtr thread) ...@@ -236,6 +236,11 @@ void virThreadJoin(virThreadPtr thread)
pthread_join(thread->thread, NULL); pthread_join(thread->thread, NULL);
} }
void virThreadCancel(virThreadPtr thread)
{
pthread_cancel(thread->thread);
}
int virThreadLocalInit(virThreadLocalPtr l, int virThreadLocalInit(virThreadLocalPtr l,
virThreadLocalCleanup c) virThreadLocalCleanup c)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册