2 * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: taskpool.h,v 1.15 2007-06-19 23:47:18 tbox Exp $ */
20 #ifndef ISC_TASKPOOL_H
21 #define ISC_TASKPOOL_H 1
27 /*! \file isc/taskpool.h
28 * \brief A task pool is a mechanism for sharing a small number of tasks
29 * among a large number of objects such that each object is
30 * assigned a unique task, but each task may be shared by several
33 * Task pools are used to let objects that can exist in large
34 * numbers (e.g., zones) use tasks for synchronization without
35 * the memory overhead and unfair scheduling competition that
36 * could result from creating a separate task for each object.
53 typedef struct isc_taskpool isc_taskpool_t;
60 isc_taskpool_create(isc_taskmgr_t *tmgr, isc_mem_t *mctx,
61 unsigned int ntasks, unsigned int quantum,
62 isc_taskpool_t **poolp);
64 * Create a task pool of "ntasks" tasks, each with quantum
69 *\li 'tmgr' is a valid task manager.
71 *\li 'mctx' is a valid memory context.
73 *\li poolp != NULL && *poolp == NULL
77 *\li On success, '*taskp' points to the new task pool.
83 *\li #ISC_R_UNEXPECTED
87 isc_taskpool_gettask(isc_taskpool_t *pool, unsigned int hash,
88 isc_task_t **targetp);
90 * Attach to the task corresponding to the hash value "hash".
94 isc_taskpool_destroy(isc_taskpool_t **poolp);
96 * Destroy a task pool. The tasks in the pool are detached but not
100 * \li '*poolp' is a valid task pool.
105 #endif /* ISC_TASKPOOL_H */