summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2022-04-06 17:29:20 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-04-06 17:29:20 +0000
commita9b2fcd9db5f9a705c9bbbc1bac08f347aecba9f (patch)
tree231d4dc7a41fee6dbb46610359b9d873866f32cd
parent5fe67d4025b4519aec672473b4354dda44ed641f (diff)
parentbf0155a0653d3ff3c3b18ce9d886ccd3579be126 (diff)
Merge "rust: Mark DeathRecipient Send and Sync" am: 593991bfd9 am: 3d3003b3cf am: bf0155a065
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2054944 Change-Id: I13589bb3cd62d95032a80dba20ab7f1184a3b1ba Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/binder/rust/src/proxy.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/binder/rust/src/proxy.rs b/libs/binder/rust/src/proxy.rs
index e3e47305d4..4df557bee0 100644
--- a/libs/binder/rust/src/proxy.rs
+++ b/libs/binder/rust/src/proxy.rs
@@ -575,6 +575,20 @@ struct DeathRecipientVtable {
cookie_decr_refcount: unsafe extern "C" fn(*mut c_void),
}
+/// # Safety
+///
+/// A `DeathRecipient` is a wrapper around `AIBinder_DeathRecipient` and a pointer
+/// to a `Fn` which is `Sync` and `Send` (the cookie field). As
+/// `AIBinder_DeathRecipient` is threadsafe, this structure is too.
+unsafe impl Send for DeathRecipient {}
+
+/// # Safety
+///
+/// A `DeathRecipient` is a wrapper around `AIBinder_DeathRecipient` and a pointer
+/// to a `Fn` which is `Sync` and `Send` (the cookie field). As
+/// `AIBinder_DeathRecipient` is threadsafe, this structure is too.
+unsafe impl Sync for DeathRecipient {}
+
impl DeathRecipient {
/// Create a new death recipient that will call the given callback when its
/// associated object dies.