/src/bind9/lib/isc/mutex.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) Internet Systems Consortium, Inc. ("ISC") |
3 | | * |
4 | | * SPDX-License-Identifier: MPL-2.0 |
5 | | * |
6 | | * This Source Code Form is subject to the terms of the Mozilla Public |
7 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
8 | | * file, you can obtain one at https://mozilla.org/MPL/2.0/. |
9 | | * |
10 | | * See the COPYRIGHT file distributed with this work for additional |
11 | | * information regarding copyright ownership. |
12 | | */ |
13 | | |
14 | | /*! \file */ |
15 | | |
16 | | #include <errno.h> |
17 | | #include <stdbool.h> |
18 | | #include <stdio.h> |
19 | | #include <sys/time.h> |
20 | | #include <time.h> |
21 | | |
22 | | #include <isc/mutex.h> |
23 | | #include <isc/once.h> |
24 | | #include <isc/strerr.h> |
25 | | #include <isc/string.h> |
26 | | #include <isc/util.h> |
27 | | |
28 | | #include "mutex_p.h" |
29 | | |
30 | | pthread_mutexattr_t isc__mutex_init_attr; |
31 | | |
32 | | void |
33 | 22 | isc__mutex_initialize(void) { |
34 | 22 | RUNTIME_CHECK(pthread_mutexattr_init(&isc__mutex_init_attr) == 0); |
35 | | #if ISC_MUTEX_ERROR_CHECK |
36 | | RUNTIME_CHECK(pthread_mutexattr_settype(&isc__mutex_init_attr, |
37 | | PTHREAD_MUTEX_ERRORCHECK) == 0); |
38 | | #elif HAVE_PTHREAD_MUTEX_ADAPTIVE_NP |
39 | 22 | RUNTIME_CHECK(pthread_mutexattr_settype(&isc__mutex_init_attr, |
40 | 22 | PTHREAD_MUTEX_ADAPTIVE_NP) == |
41 | 22 | 0); |
42 | 22 | #endif |
43 | 22 | } |
44 | | |
45 | | void |
46 | 0 | isc__mutex_shutdown(void) { |
47 | 0 | /* noop */; |
48 | 0 | } |