Received: from eggs.gnu.org ([2001:4830:134:3::10]:52181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKJCa-0002fH-Sa for qemu-devel@nongnu.org; Wed, 29 Jul 2015 00:42:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKJCa-00056A-48 for qemu-devel@nongnu.org; Wed, 29 Jul 2015 00:42:48 -0400 From: Fam Zheng Date: Wed, 29 Jul 2015 12:42:11 +0800 Message-Id: <1438144934-23619-9-git-send-email-famz@redhat.com> In-Reply-To: <1438144934-23619-1-git-send-email-famz@redhat.com> References: <1438144934-23619-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v2 08/11] aio-win32: Implement aio_{disable, enable}_clients List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Signed-off-by: Fam Zheng --- aio-win32.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/aio-win32.c b/aio-win32.c index f5ecf57..1f6a3f0 100644 --- a/aio-win32.c +++ b/aio-win32.c @@ -28,6 +28,7 @@ struct AioHandler { GPollFD pfd; int deleted; void *opaque; + int disable_cnt; int type; QLIST_ENTRY(AioHandler) node; }; @@ -309,7 +310,7 @@ bool aio_poll(AioContext *ctx, bool blocking) /* fill fd sets */ count = 0; QLIST_FOREACH(node, &ctx->aio_handlers, node) { - if (!node->deleted && node->io_notify) { + if (!node->deleted && node->io_notify && !node->disable_cnt) { events[count++] = event_notifier_get_handle(node->e); } } @@ -368,3 +369,17 @@ bool aio_poll(AioContext *ctx, bool blocking) aio_context_release(ctx); return progress; } + +void aio_disable_enable_clients(AioContext *ctx, int clients_mask, + bool is_disable) +{ + AioHandler *node; + aio_context_acquire(ctx); + + QLIST_FOREACH(node, &ctx->aio_handlers, node) { + if (!node->deleted && node->type & clients_mask) { + node->disable_cnt += is_disable ? 1 : -1; + } + } + aio_context_release(ctx); +} -- 2.4.3