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

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



On 03/06/2013 05:49 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> Add a virThreadCancel function. This functional is inherantly

s/inherantly/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    | 1 +
>  src/util/virthread.h        | 1 +
>  src/util/virthreadpthread.c | 5 +++++
>  3 files changed, 7 insertions(+)
> 

> +++ b/src/util/virthreadpthread.c
> @@ -236,6 +236,11 @@ void virThreadJoin(virThreadPtr thread)
>      pthread_join(thread->thread, NULL);
>  }
>  
> +void virThreadCancel(virThreadPtr thread)

It would help to add documentation right before this implementation that
mentions that the function exists SOLELY for use by threads created by
third-party libraries which are prepared for cancellation, and that most
libvirt threads do not qualify.  Having the discouraging comment tucked
away solely in the commit message won't help a future coder who doesn't
realize the dangers.

ACK with the comment added.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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