Skip to content

Commit

Permalink
SharedMutex TSAN: call destroy only if the annotation was created
Browse files Browse the repository at this point in the history
Summary:
SharedMutex TSAN: call destroy only if the annotation was created

(Note: this ignores all push blocking failures!)

Reviewed By: yfeldblum

Differential Revision: D27379654

fbshipit-source-id: 90be62eb9e932c83e025a96dd36c4cba992e6267
  • Loading branch information
dmm-fb authored and facebook-github-bot committed Mar 28, 2021
1 parent 6d8bd01 commit 8aeb9ba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions folly/SharedMutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,10 @@ class SharedMutexImpl : std::conditional_t<

void annotateDestroy() {
if (AnnotateForThreadSanitizer) {
annotateLazyCreate();
annotate_rwlock_destroy(this, __FILE__, __LINE__);
// call destroy only if the annotation was created
if (state_.load() & kAnnotationCreated) {
annotate_rwlock_destroy(this, __FILE__, __LINE__);
}
}
}

Expand Down

0 comments on commit 8aeb9ba

Please sign in to comment.