Conversation
Produced by this ABSL_UNLOCK_FUNCTION(lock_)
#ifndef SWIG
// Documented in the .cc file.
void UnlockAndSignal() ABSL_UNLOCK_FUNCTION(lock_)
ABSL_UNLOCK_FUNCTION(update_state_->wait_mutex);
#endif
| } | ||
|
|
||
| inline bool IsHeld() const { | ||
| inline bool IsHeld() const ABSL_ASSERT_EXCLUSIVE_LOCK() { |
There was a problem hiding this comment.
I didn't look at this closely enough.
ABSL_ASSERT_EXCLUSIVE_LOCK is for a function that assert()s / terminates.
https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#assert-capability-and-assert-shared-capability
Can you remove ABSL_ASSERT_EXCLUSIVE_LOCK() for now or make an AssertHeld() function and use that?
There was a problem hiding this comment.
AssertHeld() asserts in opt mode as well as dbg, so just remove ABSL_ASSERT_EXCLUSIVE_LOCK.
There was a problem hiding this comment.
Made PR to remove incorrect annotation.
There was a problem hiding this comment.
About assertheld I'm not sure, because usecase in s2 different:
ABSL_DCHECK(cells_lock_.IsHeld());
There was a problem hiding this comment.
Anyway it compiles without any declaration for IsHeld() so it's probably ok to keep it like this for now?
Produced by this
ABSL_UNLOCK_FUNCTION(lock_)for thread analysis noone called Lock, so it thinks unlock called without lock