offer GUARDED_BY() and equivalent macros for annotating thread safety and locking

NEW
Unassigned

Status

()

--
enhancement
4 years ago
a year ago

People

(Reporter: jesup, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
The next import of WebRTC.org code will include GUARDED_BY(a_critical_section) annotations. (on clang, devolves to __attribute__(guarded_by(a_critical_section)) )

This is derived from https://code.google.com/p/gperftools/source/browse/src/base/thread_annotations.h and modified in webrtc.org for clang (from GCC), so likely we could have it do both.

In the webrtc.org codebase, it's in webrtc/base/thread_annotations.h:
https://code.google.com/p/webrtc/source/browse/trunk/webrtc/base/thread_annotations.h

This would likely allow better analysis ala tsan and be better (and more maintainable) than 10 million AssertCurrentThreadOwns()s in the source.

Comment 1

4 years ago
I remember seeing something along these lines in a patch, that added macros annotating things for valgrind purposes (or its thread-safety-checking sub-variant).  Not sure if it landed or not, and I can't find it in open mfbt bugs right now, and I don't remember names well enough to search for it.  (But said names closely paralleled valgrind macro name concepts, so that'd be the way to search to find it, I think.)
You need to log in before you can comment on or make changes to this bug.