@@ -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);
+}
Signed-off-by: Fam Zheng <famz@redhat.com> --- aio-win32.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)