Re: [Qemu-devel] [PATCH 19/25] aio: add generic thread-pool facility

2012-10-31 Thread Stefan Hajnoczi
On Wed, Oct 31, 2012 at 10:41 AM, Paolo Bonzini wrote: > Il 30/10/2012 20:13, Stefan Hajnoczi ha scritto: >> On Fri, Oct 26, 2012 at 04:05:49PM +0200, Paolo Bonzini wrote: >>> +static void event_notifier_ready(EventNotifier *notifier) >>> +{ >>> +ThreadPoolElement *elem, *next; >>> + >>> +

Re: [Qemu-devel] [PATCH 19/25] aio: add generic thread-pool facility

2012-10-31 Thread Paolo Bonzini
Il 30/10/2012 20:13, Stefan Hajnoczi ha scritto: > On Fri, Oct 26, 2012 at 04:05:49PM +0200, Paolo Bonzini wrote: >> +static void event_notifier_ready(EventNotifier *notifier) >> +{ >> +ThreadPoolElement *elem, *next; >> + >> +event_notifier_test_and_clear(notifier); >> +restart: >> +QL

Re: [Qemu-devel] [PATCH 19/25] aio: add generic thread-pool facility

2012-10-31 Thread Stefan Hajnoczi
On Fri, Oct 26, 2012 at 04:05:49PM +0200, Paolo Bonzini wrote: > +static void event_notifier_ready(EventNotifier *notifier) > +{ > +ThreadPoolElement *elem, *next; > + > +event_notifier_test_and_clear(notifier); > +restart: > +QLIST_FOREACH_SAFE(elem, &head, all, next) { > +if (

[Qemu-devel] [PATCH 19/25] aio: add generic thread-pool facility

2012-10-26 Thread Paolo Bonzini
Add a generic thread-pool. The code is roughly based on posix-aio-compat.c, with some changes, especially the following: - use QemuSemaphore instead of QemuCond; - separate the state of the thread from the return code of the worker function. The return code is totally opaque for the thread pool