<p dir="ltr">I seem to recall Zach might have come across some reason we couldn't use the standard library primitives here...?</p>
<div class="gmail_quote">On Aug 23, 2014 9:59 PM, "Dylan Noblesmith" <<a href="mailto:nobled@dreamwidth.org">nobled@dreamwidth.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sat, Aug 23, 2014 at 8:45 PM, Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>> wrote:<br>
><br>
> On Sat, Aug 23, 2014 at 4:07 PM, Dylan Noblesmith <<a href="mailto:nobled@dreamwidth.org">nobled@dreamwidth.org</a>><br>
> wrote:<br>
>><br>
>> Support: add llvm::unique_lock<br>
>><br>
>> Based on the STL class of the same name, it guards a mutex<br>
>> while also allowing it to be unlocked conditionally before<br>
>> destruction.<br>
><br>
><br>
> I didn't notice this in the pre-commit review (the subject didn't really<br>
> make it clear what you were planning on), but why do we need our own? Why<br>
> can't we use std::unique_lock? I'm sure there is some reason, but I'm pretty<br>
> sure it is a bug and not a feature and I'm somewhat opposed to us adding<br>
> this kind of thing just to remove it later rather than fixing the underlying<br>
> problems so that we can use std::unique_lock....<br>
I guess we could, I was hesitant to do that because AFAICS there are<br>
zero in-tree "#include <mutex>" users at all right now, so it'd be the<br>
first and I assumed the status quo was intentional for portability's<br>
sake.<br>
<br>
I mean, if we can start using STL threading things now, we could also<br>
completely rip out ScopedLock and MutexGuard in favor of<br>
std::lock_guard. And rewrite llvm_execute_on_thread(). And replace<br>
sys::Mutex with std::recursive_mutex instead.<br>
<br>
And is there still a reason to use sys::ThreadLocal<> instead of thread_local?<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>