Lines Matching refs:batch
72 CoroutinePoolBatch *batch = g_new(CoroutinePoolBatch, 1); in coroutine_pool_batch_new() local
74 QSLIST_INIT(&batch->list); in coroutine_pool_batch_new()
75 batch->size = 0; in coroutine_pool_batch_new()
76 return batch; in coroutine_pool_batch_new()
79 static void coroutine_pool_batch_delete(CoroutinePoolBatch *batch) in coroutine_pool_batch_delete() argument
84 QSLIST_FOREACH_SAFE(co, &batch->list, pool_next, tmp) { in coroutine_pool_batch_delete()
85 QSLIST_REMOVE_HEAD(&batch->list, pool_next); in coroutine_pool_batch_delete()
88 g_free(batch); in coroutine_pool_batch_delete()
94 CoroutinePoolBatch *batch; in local_pool_cleanup() local
97 QSLIST_FOREACH_SAFE(batch, local_pool, next, tmp) { in local_pool_cleanup()
99 coroutine_pool_batch_delete(batch); in local_pool_cleanup()
117 CoroutinePoolBatch *batch = QSLIST_FIRST(local_pool); in coroutine_pool_get_local() local
120 if (unlikely(!batch)) { in coroutine_pool_get_local()
124 co = QSLIST_FIRST(&batch->list); in coroutine_pool_get_local()
125 QSLIST_REMOVE_HEAD(&batch->list, pool_next); in coroutine_pool_get_local()
126 batch->size--; in coroutine_pool_get_local()
128 if (batch->size == 0) { in coroutine_pool_get_local()
130 coroutine_pool_batch_delete(batch); in coroutine_pool_get_local()
139 CoroutinePoolBatch *batch = NULL; in coroutine_pool_refill_local() local
142 batch = QSLIST_FIRST(&global_pool); in coroutine_pool_refill_local()
144 if (batch) { in coroutine_pool_refill_local()
146 global_pool_size -= batch->size; in coroutine_pool_refill_local()
150 if (batch) { in coroutine_pool_refill_local()
151 QSLIST_INSERT_HEAD(local_pool, batch, next); in coroutine_pool_refill_local()
157 static void coroutine_pool_put_global(CoroutinePoolBatch *batch) in coroutine_pool_put_global() argument
164 QSLIST_INSERT_HEAD(&global_pool, batch, next); in coroutine_pool_put_global()
167 global_pool_size += batch->size; in coroutine_pool_put_global()
173 coroutine_pool_batch_delete(batch); in coroutine_pool_put_global()
192 CoroutinePoolBatch *batch = QSLIST_FIRST(local_pool); in coroutine_pool_put() local
194 if (unlikely(!batch)) { in coroutine_pool_put()
195 batch = coroutine_pool_batch_new(); in coroutine_pool_put()
196 QSLIST_INSERT_HEAD(local_pool, batch, next); in coroutine_pool_put()
200 if (unlikely(batch->size >= COROUTINE_POOL_BATCH_MAX_SIZE)) { in coroutine_pool_put()
201 CoroutinePoolBatch *next = QSLIST_NEXT(batch, next); in coroutine_pool_put()
206 coroutine_pool_put_global(batch); in coroutine_pool_put()
209 batch = coroutine_pool_batch_new(); in coroutine_pool_put()
210 QSLIST_INSERT_HEAD(local_pool, batch, next); in coroutine_pool_put()
213 QSLIST_INSERT_HEAD(&batch->list, co, pool_next); in coroutine_pool_put()
214 batch->size++; in coroutine_pool_put()