Lines Matching refs:pool

49 	isc_taskpool_t *pool;
52 pool = isc_mem_get(mctx, sizeof(*pool));
53 if (pool == NULL)
56 pool->mctx = NULL;
57 isc_mem_attach(mctx, &pool->mctx);
58 pool->ntasks = ntasks;
59 pool->quantum = quantum;
60 pool->tmgr = tmgr;
61 pool->tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
62 if (pool->tasks == NULL) {
63 isc_mem_putanddetach(&pool->mctx, pool, sizeof(*pool));
67 pool->tasks[i] = NULL;
69 *poolp = pool;
79 isc_taskpool_t *pool = NULL;
84 /* Allocate the pool structure */
85 result = alloc_pool(tmgr, mctx, ntasks, quantum, &pool);
91 result = isc_task_create(tmgr, quantum, &pool->tasks[i]);
93 isc_taskpool_destroy(&pool);
96 isc_task_setname(pool->tasks[i], "taskpool", NULL);
99 *poolp = pool;
104 isc_taskpool_gettask(isc_taskpool_t *pool, isc_task_t **targetp) {
107 isc_task_attach(pool->tasks[i % pool->ntasks], targetp);
111 isc_taskpool_size(isc_taskpool_t *pool) {
112 REQUIRE(pool != NULL);
113 return (pool->ntasks);
121 isc_taskpool_t *pool;
126 pool = *sourcep;
127 if (size > pool->ntasks) {
131 /* Allocate a new pool structure */
132 result = alloc_pool(pool->tmgr, pool->mctx, size,
133 pool->quantum, &newpool);
137 /* Copy over the tasks from the old pool */
138 for (i = 0; i < pool->ntasks; i++) {
139 newpool->tasks[i] = pool->tasks[i];
140 pool->tasks[i] = NULL;
144 for (i = pool->ntasks; i < size; i++) {
145 result = isc_task_create(pool->tmgr, pool->quantum,
154 isc_taskpool_destroy(&pool);
155 pool = newpool;
159 *targetp = pool;
166 isc_taskpool_t *pool = *poolp;
167 for (i = 0; i < pool->ntasks; i++) {
168 if (pool->tasks[i] != NULL) {
169 isc_task_detach(&pool->tasks[i]);
172 isc_mem_put(pool->mctx, pool->tasks,
173 pool->ntasks * sizeof(isc_task_t *));
174 isc_mem_putanddetach(&pool->mctx, pool, sizeof(*pool));