1 /* $NetBSD: mutexblock.h,v 1.4 2014/12/10 04:38:00 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") 5 * Copyright (C) 1999-2001 Internet Software Consortium. 6 * 7 * Permission to use, copy, modify, and/or distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /* Id: mutexblock.h,v 1.17 2007/06/19 23:47:18 tbox Exp */ 21 22 #ifndef ISC_MUTEXBLOCK_H 23 #define ISC_MUTEXBLOCK_H 1 24 25 /*! \file isc/mutexblock.h */ 26 27 #include <isc/lang.h> 28 #include <isc/mutex.h> 29 #include <isc/types.h> 30 31 ISC_LANG_BEGINDECLS 32 33 isc_result_t 34 isc_mutexblock_init(isc_mutex_t *block, unsigned int count); 35 /*%< 36 * Initialize a block of locks. If an error occurs all initialized locks 37 * will be destroyed, if possible. 38 * 39 * Requires: 40 * 41 *\li block != NULL 42 * 43 *\li count > 0 44 * 45 * Returns: 46 * 47 *\li Any code isc_mutex_init() can return is a valid return for this 48 * function. 49 */ 50 51 isc_result_t 52 isc_mutexblock_destroy(isc_mutex_t *block, unsigned int count); 53 /*%< 54 * Destroy a block of locks. 55 * 56 * Requires: 57 * 58 *\li block != NULL 59 * 60 *\li count > 0 61 * 62 *\li Each lock in the block be initialized via isc_mutex_init() or 63 * the whole block was initialized via isc_mutex_initblock(). 64 * 65 * Returns: 66 * 67 *\li Any code isc_mutex_init() can return is a valid return for this 68 * function. 69 */ 70 71 ISC_LANG_ENDDECLS 72 73 #endif /* ISC_MUTEXBLOCK_H */ 74