CriticalSectionWrapper should have an AssertAcquired() method
|Reported by email@example.com, Sep 9 2013||Back to list|
Came up in CR: http://webrtc-codereview.appspot.com/2032004/diff/92001/webrtc/modules/audio_device/android/opensles_input.cc#newcode377 If CriticalSectionWrapper::AssertAcquired() existed then code could be better self-documenting. CSW::AA() should assert(false) if the lock is not held and be a no-op in NDEBUG mode. Sample impl in Chromium: https://code.google.com/p/chromium/codesearch#chromium/src/base/synchronization/lock.h&sq=package:chromium&type=cs&l=32
Dec 17 2014,
Jan 6 2015,
Hey, pbos, who owns SystemWrappers?
Jan 7 2015,
Everyone, enjoy! :) Note that we do have (and use) thread annotations in webrtc/base/thread_annotations.h to compile-time enforce that locks are taken. These seem to be enough for us in most cases. I think we can close this bug unless you disagree. In the example fischman@ pointed to HandleOverrun can be annotated as requiring a lock to be taken which would've solved this in compile-time (better than runtime asserts).
Nov 8 2016,
Dec 14 2016,
Sign in to add a comment