Re: [Qemu-devel] [RFC PATCH v2 5/8] thread-pool: Implement .cancel_async

2014-08-26 Thread Fam Zheng
On Tue, 08/26 10:42, Paolo Bonzini wrote: > Il 26/08/2014 08:08, Fam Zheng ha scritto: > > +qemu_mutex_lock(&pool->lock); > > +if (thread_pool_cancel_from_queue(elem)) { > > +elem->state = THREAD_CANCELED_ASYNC; > > +} > > Can you simply set it to THREAD_DONE (and set elem->ret

Re: [Qemu-devel] [RFC PATCH v2 5/8] thread-pool: Implement .cancel_async

2014-08-26 Thread Paolo Bonzini
Il 26/08/2014 08:08, Fam Zheng ha scritto: > +qemu_mutex_lock(&pool->lock); > +if (thread_pool_cancel_from_queue(elem)) { > +elem->state = THREAD_CANCELED_ASYNC; > +} Can you simply set it to THREAD_DONE (and set elem->ret to -ECANCELED)? Paolo

[Qemu-devel] [RFC PATCH v2 5/8] thread-pool: Implement .cancel_async

2014-08-25 Thread Fam Zheng
The .cancel_async reuses the first half of .cancel: try to steal the request if not submitted yet. In this case set the elem to a special status THREAD_CANCELED_ASYNC, which means thread_pool_completion_bh should call the cb with -ECANCELED. If the request is already submitted, do nothing, as we k