Lines Matching defs:pool

40 	isc_taskpool_t *pool;
43 pool = isc_mem_get(mctx, sizeof(*pool));
44 if (pool == NULL)
47 pool->mctx = NULL;
48 isc_mem_attach(mctx, &pool->mctx);
49 pool->ntasks = ntasks;
50 pool->quantum = quantum;
51 pool->tmgr = tmgr;
52 pool->tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
53 if (pool->tasks == NULL) {
54 isc_mem_putanddetach(&pool->mctx, pool, sizeof(*pool));
58 pool->tasks[i] = NULL;
60 *poolp = pool;
70 isc_taskpool_t *pool = NULL;
75 /* Allocate the pool structure */
76 result = alloc_pool(tmgr, mctx, ntasks, quantum, &pool);
82 result = isc_task_create(tmgr, quantum, &pool->tasks[i]);
84 isc_taskpool_destroy(&pool);
87 isc_task_setname(pool->tasks[i], "taskpool", NULL);
90 *poolp = pool;
95 isc_taskpool_gettask(isc_taskpool_t *pool, isc_task_t **targetp) {
98 isc_task_attach(pool->tasks[i % pool->ntasks], targetp);
102 isc_taskpool_size(isc_taskpool_t *pool) {
103 REQUIRE(pool != NULL);
104 return (pool->ntasks);
112 isc_taskpool_t *pool;
117 pool = *sourcep;
118 if (size > pool->ntasks) {
122 /* Allocate a new pool structure */
123 result = alloc_pool(pool->tmgr, pool->mctx, size,
124 pool->quantum, &newpool);
128 /* Copy over the tasks from the old pool */
129 for (i = 0; i < pool->ntasks; i++) {
130 newpool->tasks[i] = pool->tasks[i];
131 pool->tasks[i] = NULL;
135 for (i = pool->ntasks; i < size; i++) {
136 result = isc_task_create(pool->tmgr, pool->quantum,
145 isc_taskpool_destroy(&pool);
146 pool = newpool;
150 *targetp = pool;
157 isc_taskpool_t *pool = *poolp;
158 for (i = 0; i < pool->ntasks; i++) {
159 if (pool->tasks[i] != NULL)
160 isc_task_detach(&pool->tasks[i]);
162 isc_mem_put(pool->mctx, pool->tasks,
163 pool->ntasks * sizeof(isc_task_t *));
164 isc_mem_putanddetach(&pool->mctx, pool, sizeof(*pool));
169 isc_taskpool_setprivilege(isc_taskpool_t *pool, isc_boolean_t priv) {
172 REQUIRE(pool != NULL);
174 for (i = 0; i < pool->ntasks; i++) {
175 if (pool->tasks[i] != NULL)
176 isc_task_setprivilege(pool->tasks[i], priv);