Re: [PATCH 02/12] Add API for thread cancellation

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

 



On 02.05.2012 13:44, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> * src/util/threads-pthread.c, src/util/threads.h: Add virThreadCancel
> ---
>  src/util/threads-pthread.c |    5 +++++
>  src/util/threads.h         |    1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/src/util/threads-pthread.c b/src/util/threads-pthread.c
> index ea64887..cfd0b24 100644
> --- a/src/util/threads-pthread.c
> +++ b/src/util/threads-pthread.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)
>  {
> diff --git a/src/util/threads.h b/src/util/threads.h
> index e5000ea..9c1ef99 100644
> --- a/src/util/threads.h
> +++ b/src/util/threads.h
> @@ -53,6 +53,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

Okay, if we are brave enough. Although, win32 implementation is missing.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]