<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-24 21:21 GMT+01:00 Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5"><br>
On Mar 24, 2014, at 11:36 AM, Piotr Rak <<a href="mailto:piotr.rak@gmail.com">piotr.rak@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> 2014-03-24 17:58 GMT+01:00 Greg Clayton <<a href="mailto:gclayton@apple.com">gclayton@apple.com</a>>:<br>
> Note that std::once can be used to enforce "run once" and we don't have to worry about each platform (like we would have to if we used pthread_once).<br>
><br>
> Modified version submitted with:<br>
><br>
> Author: gclayton<br>
> Date: Mon Mar 24 11:50:33 2014<br>
> New Revision: 204622<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=204622&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=204622&view=rev</a><br>
> Log:<br>
> Modified patch from Piotr Rak that makes GetSharedModuleList() more thread safe and also fixed a missed member initialization on the copy contractor and also makes the assignment operator safer.<br>
><br>
> Modified:<br>
> lldb/trunk/source/Core/ModuleList.cpp<br>
><br>
><br>
> Thanks, that's great we can use that, I have not seen any use of std::once, and that's why I was avoiding it.<br>
> Like I avoided ranged version of for before I have noticed we already use it.<br>
> I've seen comments about lack of atomic for Windows in debug shared_ptr implementation, and also we wrap things like mutex, condition variable, etc...<br>
><br>
> For future:<br>
> Are there any clear guidelines what feature set form C++11 is safe to use?<br>
<br>
</div></div>I would like to eventually switch over to using all the C++11 mutex classes, but haven't gotten around to it. The C++11 mutex classes would have also solved the issue you ran into where you want to simultaneously lock two mutex objects.<br>
<br>
> Or we shouldn't limit ourselves until someone starts screaming out loud?<br>
<br>
We generally need to make sure MSVC implements any C++11 we need. Both GCC and clang are pretty good at C++11, but MSVC generally doesn't keep up with the standard as well.<br>
<br><br>
</blockquote></div><br></div><div class="gmail_extra">Thanks again, </div><div class="gmail_extra"><br></div><div class="gmail_extra">Links from Todd and this clears up things bit more for me.</div><div class="gmail_extra">
<br></div><div class="gmail_extra">It would be really nice to have things like that as *given* and move the support code to bit higher level threading primitives.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
However I am not understanding lldb architecture enough to say what would it might look like yet.</div><div class="gmail_extra"><br></div><div class="gmail_extra">/P</div></div>