jingham added a comment.

This is a fairly common idiom in lldb and seems to me quite obvious.  If the 
API to get an object requires a lock guard of some sort, then you have to hold 
the lock while using the object.

As a general practice requiring a wrapper like this for every use of a should 
be locked object would make the code noisy and hard to read.  The only error 
you would be protecting against is that somebody used the entity after the lock 
went out of scope.  You could use some kind of markup to enforce this 
requirement, but you also have to be pretty sloppy to make this kind of error, 
so I'm not sure this it worth going to great lengths to protect against.

In this limited use, I guess I don't object seriously, but don't like this as a 
general pattern.


Repository:
  rL LLVM

https://reviews.llvm.org/D35083



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to