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
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits