⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢠⣴⣿⣿⣿⣷⣼⣿⠀⣴⠾⠷⠶⠦⡄⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢠⡤⢶⣦⣾⣿⣿⣿⣿⣿⣿⣿⠀⣿⣶⣶⣦⣄⠳⣤⣤⠄⠀⠀⠀
⠀⠀⠀⢀⣼⣳⡿⢻⣿⣿⣿⣿⣿⣿⣿⣿⣶⣿⣿⣗⠈⠙⠻⣶⣄⡀⠀⠀⠀
⠀⠀⠀⣰⠿⠁⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄⠀⠀⠈⠳⣤⠀⠀
⠀⠀⢀⡟⠀⢰⣿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⠉⠁⠈⠻⣶⣄⠀⠀⠈⠛⢦   
⠀⣀⡼⠃⠀⣼⡟⠀⠀⢸⣿⡿⠉⣿⡿⠿⠛⣿⡄⠀⠀⠀⠙⠿⣆⠀⠀⠀⠈
⠈⠁⠀⠀⢸⡟⠀⠀⠀⢸⣿⠀⠀⣿⠁⠀⠀⠈⠃⠀⠀⠀⠀⠀⠘⢷⡄⠀⠀
⠀⠀⠀⠀⣼⠃⠀⠀⠀⢸⡟⠀⠀⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⡆⠀
⠀⠀⠀⣠⡏⠀⠀⠀⠀⣼⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠻⠃⠀⠀⠀⠀⣻⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

Current Dir: /usr/include/bind9/isc/

[FILE] aes.h [ edit | delete | rename | download ]
[FILE] app.h [ edit | delete | rename | download ]
[FILE] assertions.h [ edit | delete | rename | download ]
[FILE] atomic.h [ edit | delete | rename | download ]
[FILE] backtrace.h [ edit | delete | rename | download ]
[FILE] base32.h [ edit | delete | rename | download ]
[FILE] base64.h [ edit | delete | rename | download ]
[FILE] bind9.h [ edit | delete | rename | download ]
[FILE] boolean.h [ edit | delete | rename | download ]
[FILE] buffer.h [ edit | delete | rename | download ]
[FILE] bufferlist.h [ edit | delete | rename | download ]
[FILE] commandline.h [ edit | delete | rename | download ]
[FILE] condition.h [ edit | delete | rename | download ]
[FILE] counter.h [ edit | delete | rename | download ]
[FILE] crc64.h [ edit | delete | rename | download ]
[FILE] deprecated.h [ edit | delete | rename | download ]
[FILE] dir.h [ edit | delete | rename | download ]
[FILE] entropy.h [ edit | delete | rename | download ]
[FILE] errno.h [ edit | delete | rename | download ]
[FILE] errno2result.h [ edit | delete | rename | download ]
[FILE] error.h [ edit | delete | rename | download ]
[FILE] event.h [ edit | delete | rename | download ]
[FILE] eventclass.h [ edit | delete | rename | download ]
[FILE] file.h [ edit | delete | rename | download ]
[FILE] formatcheck.h [ edit | delete | rename | download ]
[FILE] fsaccess.h [ edit | delete | rename | download ]
[FILE] hash.h [ edit | delete | rename | download ]
[FILE] heap.h [ edit | delete | rename | download ]
[FILE] hex.h [ edit | delete | rename | download ]
[FILE] hmacmd5.h [ edit | delete | rename | download ]
[FILE] hmacsha.h [ edit | delete | rename | download ]
[FILE] ht.h [ edit | delete | rename | download ]
[FILE] httpd.h [ edit | delete | rename | download ]
[FILE] int.h [ edit | delete | rename | download ]
[FILE] interfaceiter.h [ edit | delete | rename | download ]
[FILE] iterated_hash.h [ edit | delete | rename | download ]
[FILE] json.h [ edit | delete | rename | download ]
[FILE] keyboard.h [ edit | delete | rename | download ]
[FILE] lang.h [ edit | delete | rename | download ]
[FILE] lex.h [ edit | delete | rename | download ]
[FILE] lfsr.h [ edit | delete | rename | download ]
[FILE] lib.h [ edit | delete | rename | download ]
[FILE] likely.h [ edit | delete | rename | download ]
[FILE] list.h [ edit | delete | rename | download ]
[FILE] log.h [ edit | delete | rename | download ]
[FILE] magic.h [ edit | delete | rename | download ]
[FILE] md5.h [ edit | delete | rename | download ]
[FILE] mem.h [ edit | delete | rename | download ]
[FILE] meminfo.h [ edit | delete | rename | download ]
[FILE] msgcat.h [ edit | delete | rename | download ]
[FILE] msgs.h [ edit | delete | rename | download ]
[FILE] mutex.h [ edit | delete | rename | download ]
[FILE] mutexblock.h [ edit | delete | rename | download ]
[FILE] net.h [ edit | delete | rename | download ]
[FILE] netaddr.h [ edit | delete | rename | download ]
[FILE] netdb.h [ edit | delete | rename | download ]
[FILE] netscope.h [ edit | delete | rename | download ]
[FILE] offset.h [ edit | delete | rename | download ]
[FILE] once.h [ edit | delete | rename | download ]
[FILE] ondestroy.h [ edit | delete | rename | download ]
[FILE] os.h [ edit | delete | rename | download ]
[FILE] parseint.h [ edit | delete | rename | download ]
[FILE] platform.h [ edit | delete | rename | download ]
[FILE] pool.h [ edit | delete | rename | download ]
[FILE] portset.h [ edit | delete | rename | download ]
[FILE] print.h [ edit | delete | rename | download ]
[FILE] queue.h [ edit | delete | rename | download ]
[FILE] quota.h [ edit | delete | rename | download ]
[FILE] radix.h [ edit | delete | rename | download ]
[FILE] random.h [ edit | delete | rename | download ]
[FILE] ratelimiter.h [ edit | delete | rename | download ]
[FILE] refcount.h [ edit | delete | rename | download ]
[FILE] regex.h [ edit | delete | rename | download ]
[FILE] region.h [ edit | delete | rename | download ]
[FILE] resource.h [ edit | delete | rename | download ]
[FILE] result.h [ edit | delete | rename | download ]
[FILE] resultclass.h [ edit | delete | rename | download ]
[FILE] rwlock.h [ edit | delete | rename | download ]
[FILE] safe.h [ edit | delete | rename | download ]
[FILE] serial.h [ edit | delete | rename | download ]
[FILE] sha1.h [ edit | delete | rename | download ]
[FILE] sha2.h [ edit | delete | rename | download ]
[FILE] sockaddr.h [ edit | delete | rename | download ]
[FILE] socket.h [ edit | delete | rename | download ]
[FILE] stat.h [ edit | delete | rename | download ]
[FILE] stats.h [ edit | delete | rename | download ]
[FILE] stdio.h [ edit | delete | rename | download ]
[FILE] stdlib.h [ edit | delete | rename | download ]
[FILE] stdtime.h [ edit | delete | rename | download ]
[FILE] strerror.h [ edit | delete | rename | download ]
[FILE] string.h [ edit | delete | rename | download ]
[FILE] symtab.h [ edit | delete | rename | download ]
[FILE] syslog.h [ edit | delete | rename | download ]
[FILE] task.h [ edit | delete | rename | download ]
[FILE] taskpool.h [ edit | delete | rename | download ]
[FILE] thread.h [ edit | delete | rename | download ]
[FILE] time.h [ edit | delete | rename | download ]
[FILE] timer.h [ edit | delete | rename | download ]
[FILE] tm.h [ edit | delete | rename | download ]
[FILE] types.h [ edit | delete | rename | download ]
[FILE] util.h [ edit | delete | rename | download ]
[FILE] version.h [ edit | delete | rename | download ]
[FILE] xml.h [ edit | delete | rename | download ]

Viewing: /usr/include/bind9/isc/taskpool.h

/*
 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * See the COPYRIGHT file distributed with this work for additional
 * information regarding copyright ownership.
 */


#ifndef ISC_TASKPOOL_H
#define ISC_TASKPOOL_H 1

/*****
 ***** Module Info
 *****/

/*! \file isc/taskpool.h
 * \brief A task pool is a mechanism for sharing a small number of tasks
 * among a large number of objects such that each object is
 * assigned a unique task, but each task may be shared by several
 * objects.
 *
 * Task pools are used to let objects that can exist in large
 * numbers (e.g., zones) use tasks for synchronization without
 * the memory overhead and unfair scheduling competition that
 * could result from creating a separate task for each object.
 */


/***
 *** Imports.
 ***/

#include <isc/lang.h>
#include <isc/task.h>

ISC_LANG_BEGINDECLS

/*****
 ***** Types.
 *****/

typedef struct isc_taskpool isc_taskpool_t;

/*****
 ***** Functions.
 *****/

isc_result_t
isc_taskpool_create(isc_taskmgr_t *tmgr, isc_mem_t *mctx,
		    unsigned int ntasks, unsigned int quantum,
		    isc_taskpool_t **poolp);
/*%<
 * Create a task pool of "ntasks" tasks, each with quantum
 * "quantum".
 *
 * Requires:
 *
 *\li	'tmgr' is a valid task manager.
 *
 *\li	'mctx' is a valid memory context.
 *
 *\li	poolp != NULL && *poolp == NULL
 *
 * Ensures:
 *
 *\li	On success, '*taskp' points to the new task pool.
 *
 * Returns:
 *
 *\li	#ISC_R_SUCCESS
 *\li	#ISC_R_NOMEMORY
 *\li	#ISC_R_UNEXPECTED
 */

void
isc_taskpool_gettask(isc_taskpool_t *pool, isc_task_t **targetp);
/*%<
 * Attach to a task from the pool.  Currently the next task is chosen
 * from the pool at random.  (This may be changed in the future to
 * something that guaratees balance.)
 */

int
isc_taskpool_size(isc_taskpool_t *pool);
/*%<
 * Returns the number of tasks in the task pool 'pool'.
 */

isc_result_t
isc_taskpool_expand(isc_taskpool_t **sourcep, unsigned int size,
					isc_taskpool_t **targetp);

/*%<
 * If 'size' is larger than the number of tasks in the pool pointed to by
 * 'sourcep', then a new taskpool of size 'size' is allocated, the existing
 * tasks from are moved into it, additional tasks are created to bring the
 * total number up to 'size', and the resulting pool is attached to
 * 'targetp'.
 *
 * If 'size' is less than or equal to the tasks in pool 'source', then
 * 'sourcep' is attached to 'targetp' without any other action being taken.
 *
 * In either case, 'sourcep' is detached.
 *
 * Requires:
 *
 * \li	'sourcep' is not NULL and '*source' is not NULL
 * \li	'targetp' is not NULL and '*source' is NULL
 *
 * Ensures:
 *
 * \li	On success, '*targetp' points to a valid task pool.
 * \li	On success, '*sourcep' points to NULL.
 *
 * Returns:
 *
 * \li	#ISC_R_SUCCESS
 * \li	#ISC_R_NOMEMORY
 */

void
isc_taskpool_destroy(isc_taskpool_t **poolp);
/*%<
 * Destroy a task pool.  The tasks in the pool are detached but not
 * shut down.
 *
 * Requires:
 * \li	'*poolp' is a valid task pool.
 */

void
isc_taskpool_setprivilege(isc_taskpool_t *pool, isc_boolean_t priv);
/*%<
 * Set the privilege flag on all tasks in 'pool' to 'priv'.  If 'priv' is
 * true, then when the task manager is set into privileged mode, only
 * tasks wihin this pool will be able to execute.  (Note:  It is important
 * to turn the pool tasks' privilege back off before the last task finishes
 * executing.)
 *
 * Requires:
 * \li	'pool' is a valid task pool.
 */

ISC_LANG_ENDDECLS

#endif /* ISC_TASKPOOL_H */

Upload File: