diff options
Diffstat (limited to 'runtime/sirt_ref.h')
-rw-r--r-- | runtime/sirt_ref.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/sirt_ref.h b/runtime/sirt_ref.h index 56d81ec..3c5e4f8 100644 --- a/runtime/sirt_ref.h +++ b/runtime/sirt_ref.h @@ -35,13 +35,17 @@ class SirtRef { DCHECK_EQ(top_sirt, &sirt_); } - T& operator*() const { return *get(); } - T* operator->() const { return get(); } - T* get() const { + T& operator*() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + return *get(); + } + T* operator->() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + return get(); + } + T* get() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return down_cast<T*>(sirt_.GetReference(0)); } - void reset(T* object = NULL) { + void reset(T* object = nullptr) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { sirt_.SetReference(0, object); } |