mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
thread-pool: avoid passing the pool parameter every time
thread_pool_submit_aio() is always called on a pool taken from qemu_get_current_aio_context(), and that is the only intended use: each pool runs only in the same thread that is submitting work to it, it can't run anywhere else. Therefore simplify the thread_pool_submit* API and remove the ThreadPool function parameter. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Message-Id: <20230203131731.851116-5-eesposit@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
0fdb73112b
commit
aef04fc790
12 changed files with 27 additions and 44 deletions
|
@ -51,7 +51,6 @@ static int pr_manager_worker(void *opaque)
|
|||
int coroutine_fn pr_manager_execute(PRManager *pr_mgr, AioContext *ctx, int fd,
|
||||
struct sg_io_hdr *hdr)
|
||||
{
|
||||
ThreadPool *pool = aio_get_thread_pool(ctx);
|
||||
PRManagerData data = {
|
||||
.pr_mgr = pr_mgr,
|
||||
.fd = fd,
|
||||
|
@ -62,7 +61,7 @@ int coroutine_fn pr_manager_execute(PRManager *pr_mgr, AioContext *ctx, int fd,
|
|||
|
||||
/* The matching object_unref is in pr_manager_worker. */
|
||||
object_ref(OBJECT(pr_mgr));
|
||||
return thread_pool_submit_co(pool, pr_manager_worker, &data);
|
||||
return thread_pool_submit_co(pr_manager_worker, &data);
|
||||
}
|
||||
|
||||
bool pr_manager_is_connected(PRManager *pr_mgr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue