Commit Message

From: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
When resetting a virtqueue, it is often necessary to make sure that the
associated threadpool job isn't running anymore. Add a function to
cancel a job.
A threadpool job has three states: idle, queued and running. A job is
queued when it is in the job list. It is running when it is out the
list, but its signal count is greater than zero. It is idle when it is
both out of the list and its signal count is zero. The cancel() function
simply waits for the job to be idle. It is up to the caller to make sure
that the job isn't queued concurrently.
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>Signed-off-by: Julien Thierry <julien.thierry@arm.com>
---
include/kvm/threadpool.h | 2 ++
util/threadpool.c | 25 ++++++++++++++++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)