Lines Matching refs:pool

49 	isc_taskpool_t *pool;
52 pool = isc_mem_get(mctx, sizeof(*pool));
53 if (pool == NULL)
55 pool->mctx = mctx;
56 pool->ntasks = ntasks;
57 pool->quantum = quantum;
58 pool->tmgr = tmgr;
59 pool->tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
60 if (pool->tasks == NULL) {
61 isc_mem_put(mctx, pool, sizeof(*pool));
65 pool->tasks[i] = NULL;
67 *poolp = pool;
77 isc_taskpool_t *pool = NULL;
82 /* Allocate the pool structure */
83 result = alloc_pool(tmgr, mctx, ntasks, quantum, &pool);
89 result = isc_task_create(tmgr, quantum, &pool->tasks[i]);
91 isc_taskpool_destroy(&pool);
94 isc_task_setname(pool->tasks[i], "taskpool", NULL);
97 *poolp = pool;
102 isc_taskpool_gettask(isc_taskpool_t *pool, isc_task_t **targetp) {
105 isc_task_attach(pool->tasks[i % pool->ntasks], targetp);
109 isc_taskpool_size(isc_taskpool_t *pool) {
110 REQUIRE(pool != NULL);
111 return (pool->ntasks);
119 isc_taskpool_t *pool;
124 pool = *sourcep;
125 if (size > pool->ntasks) {
129 /* Allocate a new pool structure */
130 result = alloc_pool(pool->tmgr, pool->mctx, size,
131 pool->quantum, &newpool);
135 /* Copy over the tasks from the old pool */
136 for (i = 0; i < pool->ntasks; i++) {
137 newpool->tasks[i] = pool->tasks[i];
138 pool->tasks[i] = NULL;
142 for (i = pool->ntasks; i < size; i++) {
143 result = isc_task_create(pool->tmgr, pool->quantum,
152 isc_taskpool_destroy(&pool);
153 pool = newpool;
157 *targetp = pool;
164 isc_taskpool_t *pool = *poolp;
165 for (i = 0; i < pool->ntasks; i++) {
166 if (pool->tasks[i] != NULL)
167 isc_task_detach(&pool->tasks[i]);
169 isc_mem_put(pool->mctx, pool->tasks,
170 pool->ntasks * sizeof(isc_task_t *));
171 isc_mem_put(pool->mctx, pool, sizeof(*pool));
176 isc_taskpool_setprivilege(isc_taskpool_t *pool, isc_boolean_t priv) {
179 REQUIRE(pool != NULL);
181 for (i = 0; i < pool->ntasks; i++) {
182 if (pool->tasks[i] != NULL)
183 isc_task_setprivilege(pool->tasks[i], priv);