Skip to content

Commit b9f610a

Browse files
committed
Implement Sync for Link
Implement Sync for Link. The only operations that can be performed on a &Link are pin_path() and detach(), neither of which modify the object. pin_path() just reads an attribute and detach() performs a system call with the link's file descriptor. Hence, Sync should be fine to implement for Link. Signed-off-by: Daniel Müller <deso@posteo.net>
1 parent 69b910f commit b9f610a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

libbpf-rs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
-------------
33
- Adjusted `btf::types::EnumMember` to store value as `i64`
44
- Adjusted `btf::types::Enum64Member` to store value as `i128`
5+
- Implemented `Sync` for `Link`
56

67

78
0.25.0-beta.0

libbpf-rs/src/link.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ impl AsRawLibbpf for Link {
121121

122122
// SAFETY: `bpf_link` objects can safely be sent to a different thread.
123123
unsafe impl Send for Link {}
124+
// SAFETY: `bpf_link` has no interior mutability.
125+
unsafe impl Sync for Link {}
124126

125127
impl AsFd for Link {
126128
#[inline]

0 commit comments

Comments
 (0)