Commit df79f04f authored by Alice Ryhl's avatar Alice Ryhl
Browse files

ANDROID: rust_binder: add Process::lock_with_nodes()



Since Node uses a LockedBy<ProcessInner> for its protected data, we need
a `&mut ProcessInner` to access the node. However, if we are iterating
over the `process.nodes` rbtree, then we cannot give out exclusive
access to all of `process, as the `nodes` field is in use. To handle
this, we temporarily move the `nodes` field to a local variable (during
which `process.nodes` must not be accessed) and iterate over the local
variable instead.

Add an abstraction to make the above easier, and remove the possibility
of forgetting to put the `nodes` field back into `process` when
releasing the lock.

Bug: 423900220
Change-Id: I50139b422f6973afea4a23c496b04ffc70a956ca
Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
parent d9be16a9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment