init: Document the locking strategy used in class PropWaiterState

Let the compiler verify that lock_ is held when any of the data members
are accessed.

Bug: 266255006
Change-Id: I71b341815d84ab530627d934ad4d4681b652b9d8
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Bart Van Assche 2023-02-17 12:27:57 -08:00
parent 68a59e1c72
commit b6b7ccc24f

View file

@ -212,16 +212,16 @@ static class PropWaiterState {
}
private:
void ResetWaitForPropLocked() {
void ResetWaitForPropLocked() EXCLUSIVE_LOCKS_REQUIRED(lock_) {
wait_prop_name_.clear();
wait_prop_value_.clear();
waiting_for_prop_.reset();
}
std::mutex lock_;
std::unique_ptr<Timer> waiting_for_prop_{nullptr};
std::string wait_prop_name_;
std::string wait_prop_value_;
GUARDED_BY(lock_) std::unique_ptr<Timer> waiting_for_prop_{nullptr};
GUARDED_BY(lock_) std::string wait_prop_name_;
GUARDED_BY(lock_) std::string wait_prop_value_;
} prop_waiter_state;