1258945Sroberto/*
2258945Sroberto * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
3258945Sroberto * Copyright (C) 1999-2001  Internet Software Consortium.
4258945Sroberto *
5258945Sroberto * Permission to use, copy, modify, and/or distribute this software for any
6258945Sroberto * purpose with or without fee is hereby granted, provided that the above
7258945Sroberto * copyright notice and this permission notice appear in all copies.
8258945Sroberto *
9258945Sroberto * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10258945Sroberto * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11258945Sroberto * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12258945Sroberto * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13258945Sroberto * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14258945Sroberto * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15258945Sroberto * PERFORMANCE OF THIS SOFTWARE.
16258945Sroberto */
17258945Sroberto
18258945Sroberto/* $Id: mutexblock.h,v 1.17 2007/06/19 23:47:18 tbox Exp $ */
19258945Sroberto
20258945Sroberto#ifndef ISC_MUTEXBLOCK_H
21258945Sroberto#define ISC_MUTEXBLOCK_H 1
22258945Sroberto
23258945Sroberto/*! \file isc/mutexblock.h */
24258945Sroberto
25258945Sroberto#include <isc/lang.h>
26258945Sroberto#include <isc/mutex.h>
27258945Sroberto#include <isc/types.h>
28258945Sroberto
29258945SrobertoISC_LANG_BEGINDECLS
30258945Sroberto
31258945Srobertoisc_result_t
32258945Srobertoisc_mutexblock_init(isc_mutex_t *block, unsigned int count);
33258945Sroberto/*%<
34258945Sroberto * Initialize a block of locks.  If an error occurs all initialized locks
35258945Sroberto * will be destroyed, if possible.
36258945Sroberto *
37258945Sroberto * Requires:
38258945Sroberto *
39258945Sroberto *\li	block != NULL
40258945Sroberto *
41258945Sroberto *\li	count > 0
42258945Sroberto *
43258945Sroberto * Returns:
44258945Sroberto *
45258945Sroberto *\li	Any code isc_mutex_init() can return is a valid return for this
46258945Sroberto *	function.
47258945Sroberto */
48258945Sroberto
49258945Srobertoisc_result_t
50258945Srobertoisc_mutexblock_destroy(isc_mutex_t *block, unsigned int count);
51258945Sroberto/*%<
52258945Sroberto * Destroy a block of locks.
53258945Sroberto *
54258945Sroberto * Requires:
55258945Sroberto *
56258945Sroberto *\li	block != NULL
57258945Sroberto *
58258945Sroberto *\li	count > 0
59258945Sroberto *
60258945Sroberto *\li	Each lock in the block be initialized via isc_mutex_init() or
61258945Sroberto * 	the whole block was initialized via isc_mutex_initblock().
62258945Sroberto *
63258945Sroberto * Returns:
64258945Sroberto *
65258945Sroberto *\li	Any code isc_mutex_init() can return is a valid return for this
66258945Sroberto *	function.
67258945Sroberto */
68258945Sroberto
69258945SrobertoISC_LANG_ENDDECLS
70258945Sroberto
71258945Sroberto#endif /* ISC_MUTEXBLOCK_H */
72