labath added a comment.

In https://reviews.llvm.org/D35083#802400, @jingham wrote:

> Ah, maybe you meant applying the thread safety annotation to Sean's solution 
> to enforce the contract.  That's an interesting solution, but makes a 
> non-straightforward solution even more non-straightforward, so I agree this 
> isn't the best example...


Actually, I meant applying the annotations to *your* solution :). The 
"alternatively" meant that instead of passing the by-reference locker argument 
to enforce the contract, you would annotate the function like:

  static GetASTMap() REQUIRES_CAPABILITY(my_mutex)

Then the caller could just lock the mutex any way he likes and the compiler 
would smack him on the head if he forgets that.

However, after playing around with this more, I have become less enthusiastic 
about it -- it basically requires you to wrap all locking primitives with your 
own (annotated) classes (recent libc++'s have them out of the box, but only on 
std::mutex). So, maybe you should just ignore my comments :)


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