Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
third_party
boringssl-with-bazel
src
crypto
refcount_lock.c
Go to the documentation of this file.
1
/* Copyright (c) 2015, Google Inc.
2
*
3
* Permission to use, copy, modify, and/or distribute this software for any
4
* purpose with or without fee is hereby granted, provided that the above
5
* copyright notice and this permission notice appear in all copies.
6
*
7
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
15
#include "
internal.h
"
16
17
#include <stdlib.h>
18
19
#include <
openssl/type_check.h
>
20
21
22
#if !defined(OPENSSL_C11_ATOMIC)
23
24
OPENSSL_STATIC_ASSERT
((
CRYPTO_refcount_t
)-1 ==
CRYPTO_REFCOUNT_MAX
,
25
"CRYPTO_REFCOUNT_MAX is incorrect"
);
26
27
static
struct
CRYPTO_STATIC_MUTEX
g_refcount_lock
=
CRYPTO_STATIC_MUTEX_INIT
;
28
29
void
CRYPTO_refcount_inc
(
CRYPTO_refcount_t
*
count
) {
30
CRYPTO_STATIC_MUTEX_lock_write
(&
g_refcount_lock
);
31
if
(*
count
<
CRYPTO_REFCOUNT_MAX
) {
32
(*count)++;
33
}
34
CRYPTO_STATIC_MUTEX_unlock_write
(&
g_refcount_lock
);
35
}
36
37
int
CRYPTO_refcount_dec_and_test_zero
(
CRYPTO_refcount_t
*
count
) {
38
int
ret
;
39
40
CRYPTO_STATIC_MUTEX_lock_write
(&
g_refcount_lock
);
41
if
(*
count
== 0) {
42
abort();
43
}
44
if
(*
count
<
CRYPTO_REFCOUNT_MAX
) {
45
(*count)--;
46
}
47
ret
= (*
count
== 0);
48
CRYPTO_STATIC_MUTEX_unlock_write
(&
g_refcount_lock
);
49
50
return
ret
;
51
}
52
53
#endif // OPENSSL_C11_ATOMIC
CRYPTO_STATIC_MUTEX_INIT
#define CRYPTO_STATIC_MUTEX_INIT
Definition:
third_party/boringssl-with-bazel/src/crypto/internal.h:536
CRYPTO_STATIC_MUTEX_unlock_write
#define CRYPTO_STATIC_MUTEX_unlock_write
Definition:
boringssl_prefix_symbols.h:1135
internal.h
CRYPTO_refcount_dec_and_test_zero
int CRYPTO_refcount_dec_and_test_zero(CRYPTO_refcount_t *count)
Definition:
refcount_lock.c:37
CRYPTO_STATIC_MUTEX
Definition:
third_party/boringssl-with-bazel/src/crypto/internal.h:533
CRYPTO_refcount_inc
void CRYPTO_refcount_inc(CRYPTO_refcount_t *count)
Definition:
refcount_lock.c:29
g_refcount_lock
static struct CRYPTO_STATIC_MUTEX g_refcount_lock
Definition:
refcount_lock.c:27
CRYPTO_STATIC_MUTEX_lock_write
#define CRYPTO_STATIC_MUTEX_lock_write
Definition:
boringssl_prefix_symbols.h:1133
OPENSSL_STATIC_ASSERT
OPENSSL_STATIC_ASSERT((CRYPTO_refcount_t) -1==CRYPTO_REFCOUNT_MAX, "CRYPTO_REFCOUNT_MAX is incorrect")
count
int * count
Definition:
bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
ret
UniquePtr< SSL_SESSION > ret
Definition:
ssl_x509.cc:1029
CRYPTO_REFCOUNT_MAX
#define CRYPTO_REFCOUNT_MAX
Definition:
third_party/boringssl-with-bazel/src/crypto/internal.h:502
type_check.h
CRYPTO_refcount_t
uint32_t CRYPTO_refcount_t
Definition:
thread.h:101
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:07