On 02/15/2018 04:12 AM, Kevin Wolf wrote:
Having acquired the AioContext does not make this function return true.
The semantics are:
1. Current thread is the IOThread that runs the AioContext
2. Current thread is the main loop and the AioContext is the global
AioContext.
The function tests whether the current thread is the "native" or "home"
thread for this AioContext. Perhaps we could also call it the "poller"
thread because only that thread is allowed to call aio_poll(ctx, true).
if (aio_context_in_native_thread(ctx)) {
...
} else {
...
}
What do you think?
"home" or "native" both work for me. Or if we want to keep the name
short, maybe just changing the order and s/iothread/thread/ would be
enough: bool in_aio_context_thread(AioContext *ctx) - do you think that
would still be prone to misunderstandings?
in_aio_context_home_thread() sounds slightly better than
in_aio_context_thread(), but swapping the verb makes a nice difference
where either name is better than what we currently have.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org