Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / ntp / dist / lib / isc / refcount.c
blobe9171d13b76dd83f42a832bd374fb7f012eaaa5f
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
19 /* Id: refcount.c,v 1.5 2007/06/19 23:47:17 tbox Exp */
21 #include <config.h>
23 #include <stddef.h>
25 #include <isc/mutex.h>
26 #include <isc/refcount.h>
27 #include <isc/result.h>
29 isc_result_t
30 isc_refcount_init(isc_refcount_t *ref, unsigned int n) {
31 REQUIRE(ref != NULL);
33 ref->refs = n;
34 #if defined(ISC_PLATFORM_USETHREADS) && !defined(ISC_PLATFORM_HAVEXADD)
35 return (isc_mutex_init(&ref->lock));
36 #else
37 return (ISC_R_SUCCESS);
38 #endif