mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
thread-pool: use ThreadPool from the running thread
Use qemu_get_current_aio_context() where possible, since we always submit work to the current thread anyways. We want to also be sure that the thread submitting the work is the same as the one processing the pool, to avoid adding synchronization to the pool list. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Message-Id: <20230203131731.851116-4-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
a75e4e4365
commit
0fdb73112b
5 changed files with 21 additions and 18 deletions
|
@ -43,7 +43,7 @@ qcow2_co_process(BlockDriverState *bs, ThreadPoolFunc *func, void *arg)
|
|||
{
|
||||
int ret;
|
||||
BDRVQcow2State *s = bs->opaque;
|
||||
ThreadPool *pool = aio_get_thread_pool(bdrv_get_aio_context(bs));
|
||||
ThreadPool *pool = aio_get_thread_pool(qemu_get_current_aio_context());
|
||||
|
||||
qemu_co_mutex_lock(&s->lock);
|
||||
while (s->nb_threads >= QCOW2_MAX_THREADS) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue