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: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2012-01-23 14:58:13 +00:00
parent 32b7e92db6
commit a299714295
3 changed files with 10 additions and 0 deletions

View File

@ -1744,6 +1744,7 @@ virMutexInitRecursive;
virMutexLock;
virMutexUnlock;
virOnce;
virThreadCancel;
virThreadCreate;
virThreadID;
virThreadInitialize;

View 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

View 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)
{