Lines Matching refs:pool
40 AioTaskPool *pool = task->pool; in aio_task_co() local
42 assert(pool->busy_tasks < pool->max_busy_tasks); in aio_task_co()
43 pool->busy_tasks++; in aio_task_co()
47 pool->busy_tasks--; in aio_task_co()
49 if (task->ret < 0 && pool->status == 0) { in aio_task_co()
50 pool->status = task->ret; in aio_task_co()
55 if (pool->waiting) { in aio_task_co()
56 pool->waiting = false; in aio_task_co()
57 aio_co_wake(pool->main_co); in aio_task_co()
61 void coroutine_fn aio_task_pool_wait_one(AioTaskPool *pool) in aio_task_pool_wait_one() argument
63 assert(pool->busy_tasks > 0); in aio_task_pool_wait_one()
64 assert(qemu_coroutine_self() == pool->main_co); in aio_task_pool_wait_one()
66 pool->waiting = true; in aio_task_pool_wait_one()
69 assert(!pool->waiting); in aio_task_pool_wait_one()
70 assert(pool->busy_tasks < pool->max_busy_tasks); in aio_task_pool_wait_one()
73 void coroutine_fn aio_task_pool_wait_slot(AioTaskPool *pool) in aio_task_pool_wait_slot() argument
75 if (pool->busy_tasks < pool->max_busy_tasks) { in aio_task_pool_wait_slot()
79 aio_task_pool_wait_one(pool); in aio_task_pool_wait_slot()
82 void coroutine_fn aio_task_pool_wait_all(AioTaskPool *pool) in aio_task_pool_wait_all() argument
84 while (pool->busy_tasks > 0) { in aio_task_pool_wait_all()
85 aio_task_pool_wait_one(pool); in aio_task_pool_wait_all()
89 void coroutine_fn aio_task_pool_start_task(AioTaskPool *pool, AioTask *task) in aio_task_pool_start_task() argument
91 aio_task_pool_wait_slot(pool); in aio_task_pool_start_task()
93 task->pool = pool; in aio_task_pool_start_task()
99 AioTaskPool *pool = g_new0(AioTaskPool, 1); in aio_task_pool_new() local
103 pool->main_co = qemu_coroutine_self(); in aio_task_pool_new()
104 pool->max_busy_tasks = max_busy_tasks; in aio_task_pool_new()
106 return pool; in aio_task_pool_new()
109 void aio_task_pool_free(AioTaskPool *pool) in aio_task_pool_free() argument
111 g_free(pool); in aio_task_pool_free()
114 int aio_task_pool_status(AioTaskPool *pool) in aio_task_pool_status() argument
116 if (!pool) { in aio_task_pool_status()
120 return pool->status; in aio_task_pool_status()
123 bool aio_task_pool_empty(AioTaskPool *pool) in aio_task_pool_empty() argument
125 return pool->busy_tasks == 0; in aio_task_pool_empty()