[Lldb-commits] [PATCH] D39967: Disable breakpoints before writing memory and re-enable after.
Tatyana Krasnukha via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 22 14:34:31 PST 2018
tatyana-krasnukha added inline comments.
================
Comment at: include/lldb/Breakpoint/BreakpointSiteList.h:159-175
+ class Guard final {
+ std::recursive_mutex *m_mutex;
- typedef void (*BreakpointSiteSPMapFunc)(lldb::BreakpointSiteSP &bp,
- void *baton);
+ public:
+ explicit Guard(std::recursive_mutex &mutex) : m_mutex(&mutex) {
+ m_mutex->lock();
+ }
----------------
zturner wrote:
> tatyana-krasnukha wrote:
> > labath wrote:
> > > How is this class different from a std::unique_lock ?
> > std::unique_lock allows to call lock() and unlock() manually. Such flexibility makes code more bug-prone, so I try to avoid it if it is not really needed.
> >
> > I might inherit Guard from std::unique_lock and hide these functions, if it looks better...
> In that case use `std::lock_guard`. it is the same as `unique_lock` but doesn't allow calling `lock` and `unlock`. So it sounds like exactly what you want.
Unfortunately, it is not movable
https://reviews.llvm.org/D39967
More information about the lldb-commits
mailing list