* Blue Swirl <blauwir...@gmail.com> [2010-11-10 17:29:30]: > On Wed, Nov 10, 2010 at 1:19 PM, Arun R Bharadwaj > <a...@linux.vnet.ibm.com> wrote: > > The reason for creating this generic infrastructure is so that other > > subsystems, > > such as virtio-9p could make use of it for offloading tasks that could > > block. > > > > Signed-off-by: Arun R Bharadwaj <a...@linux.vnet.ibm.com> > > Signed-off-by: Aneesh Kumar K.V <aneesh.ku...@linux.vnet.ibm.com> > > Signed-off-by: Gautham R Shenoy <gautham.she...@gmail.com> > > Signed-off-by: Sripathi Kodi <sripat...@in.ibm.com> > > --- > > Makefile.objs | 1 > > docs/async-support.txt | 141 +++++++++++++++++++++++++++++++++++++++ > > posix-aio-compat.c | 173 > > ------------------------------------------------ > > qemu-threadlets.c | 168 > > +++++++++++++++++++++++++++++++++++++++++++++++ > > qemu-threadlets.h | 48 +++++++++++++ > > 5 files changed, 359 insertions(+), 172 deletions(-) > > create mode 100644 docs/async-support.txt > > create mode 100644 qemu-threadlets.c > > create mode 100644 qemu-threadlets.h > > > > diff --git a/qemu-threadlets.h b/qemu-threadlets.h > > new file mode 100644 > > index 0000000..f869304 > > --- /dev/null > > +++ b/qemu-threadlets.h > > @@ -0,0 +1,48 @@ > > +/* > > + * Threadlet support for offloading tasks to be executed asynchronously > > + * > > + * Copyright IBM, Corp. 2008 > > + * Copyright IBM, Corp. 2010 > > + * > > + * Authors: > > + * Anthony Liguori <aligu...@us.ibm.com> > > + * Aneesh Kumar K.V <aneesh.ku...@linux.vnet.ibm.com> > > + * Gautham R Shenoy <gautham.she...@gmail.com> > > + * > > + * This work is licensed under the terms of the GNU GPL, version 2. See > > + * the COPYING file in the top-level directory. > > + */ > > + > > +#ifndef QEMU_ASYNC_WORK_H > > +#define QEMU_ASYNC_WORK_H > > + > > +#include "qemu-queue.h" > > +#include "qemu-common.h" > > +#include "qemu-thread.h" > > + > > +typedef struct ThreadletQueue > > +{ > > + QemuMutex lock; > > + QemuCond cond; > > + int max_threads; > > + int min_threads; > > + int cur_threads; > > + int idle_threads; > > + QTAILQ_HEAD(, ThreadletWork) request_list; > > +} ThreadletQueue; > > + > > +typedef struct ThreadletWork > > +{ > > + QTAILQ_ENTRY(ThreadletWork) node; > > + void (*func)(struct ThreadletWork *work); > > +} ThreadletWork; > > + > > +extern void submit_work_to_queue(ThreadletQueue *queue, > > + ThreadletWork *work); > > +extern void submit_work(ThreadletWork *work); > > +extern int dequeue_work_on_queue(ThreadletQueue *queue, > > + ThreadletWork *work); > > +extern int dequeue_work(ThreadletWork *work); > > +extern void threadlet_queue_init(ThreadletQueue *queue, int max_threads, > > + int min_threads); > > Please remove 'extern' qualifiers, they are useless for function > declarations. In most cases they are not used in QEMU.
Will change these. Thanks for the review. -arun