LibQuicR
thread_safety.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) 2024 Cisco Systems
2 // SPDX-License-Identifier: BSD-2-Clause
3 
4 #pragma once
5 
14 #if defined(QUICR_HAS_THREAD_SAFETY_ANNOTATIONS)
16 #define QUICR_CAPABILITY(name) __attribute__((capability(name)))
17 
19 #define QUICR_ACQUIRE(...) __attribute__((acquire_capability(__VA_ARGS__)))
20 
22 #define QUICR_RELEASE(...) __attribute__((release_capability(__VA_ARGS__)))
23 
25 #define QUICR_REQUIRES(...) __attribute__((requires_capability(__VA_ARGS__)))
26 
28 #define QUICR_EXCLUDES(...) __attribute__((locks_excluded(__VA_ARGS__)))
29 
31 #define QUICR_NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis))
32 
34 #define QUICR_TRY_ACQUIRE(...) __attribute__((try_acquire_capability(__VA_ARGS__)))
35 
37 #define QUICR_GUARDED_BY(...) __attribute__((guarded_by(__VA_ARGS__)))
38 
40 #define QUICR_PT_GUARDED_BY(...) __attribute__((pt_guarded_by(__VA_ARGS__)))
41 #else
43 #define QUICR_CAPABILITY(name)
44 
46 #define QUICR_ACQUIRE(...)
47 
49 #define QUICR_RELEASE(...)
50 
52 #define QUICR_REQUIRES(...)
53 
55 #define QUICR_EXCLUDES(...)
56 
58 #define QUICR_NO_THREAD_SAFETY_ANALYSIS
59 
61 #define QUICR_TRY_ACQUIRE(...)
62 
64 #define QUICR_GUARDED_BY(...)
65 
67 #define QUICR_PT_GUARDED_BY(...)
68 #endif