On Tue, Oct 19, 2010 at 6:42 PM, Arun R Bharadwaj <a...@linux.vnet.ibm.com> wrote: > +/** > + * cancel_threadletwork_on_queue: Cancel a task queued on a Queue. > + * @queue: The queue containing the task to be cancelled. > + * @work: Contains the information of the task that needs to be cancelled. > + * > + * Returns: 0 if the task is successfully cancelled. > + * 1 otherwise.
The return value comment doesn't correspond to how I read the code. If the work was cancelled the code returns 1. Otherwise it returns 0. > + */ > +int cancel_threadletwork_on_queue(ThreadletQueue *queue, ThreadletWork *work) > +{ > + ThreadletWork *ret_work; > + int ret = 0; > + > + qemu_mutex_lock(&(queue->lock)); > + QTAILQ_FOREACH(ret_work, &(queue->request_list), node) { > + if (ret_work == work) { > + QTAILQ_REMOVE(&(queue->request_list), ret_work, node); > + ret = 1; > + break; > + } > + } > + qemu_mutex_unlock(&(queue->lock)); > + > + return ret; > +} Stefan