<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 17 Nov 2017, at 00:44, comic fans via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I'm learning the xray library and try if it can be built on windows, in<br class="">xray_fdr_logging_impl.h<br class=""><br class="">line 152 , comment written as<br class="">// Using pthread_once(...) to initialize the thread-local data structures<br class=""><br class=""><br class="">but at line 175, 183, code written as<br class=""><br class="">thread_local pthread_key_t key;<br class=""><br class=""> // Ensure that we only actually ever do the pthread initialization once.<br class=""> thread_local bool UNUSED Unused = [] {<br class=""> new (&TLSBuffer) ThreadLocalData();<br class=""> auto result = pthread_key_create(&key, +[](void *) {<br class=""> auto &TLD = *reinterpret_cast<ThreadLocalData *>(&TLSBuffer);<br class=""><br class=""><br class="">I'm confused that pthread_key_t and Unused are both thread_local<br class="">variable, doesn't it mean the following lambda will run for each<br class="">thread , and create one pthread_key_t for only one tls data(instead of<br class="">only one pthread_key_t for all thread) ? also what does the '+' before<br class="">lambda expression mean ? this may be stupid questions, could somebody<br class="">kindly helped ?<br class=""></div></div></blockquote><div><br class=""></div><div>Yeah, that comment is out-of-date (and the implementation is buggy) -- which is a shame really. :/</div><div><br class=""></div><div>But, the good news, is I think we've fixed this now in the top-of-trunk with <a href="https://reviews.llvm.org/D39526" class="">https://reviews.llvm.org/D39526</a> and <a href="https://reviews.llvm.org/D40164" class="">https://reviews.llvm.org/D40164</a>.</div><div><br class=""></div><div>Curiously though, how far did your exploration into getting XRay to build on Windows go?</div><div><br class=""></div><div>Cheers</div><div><br class=""></div></div><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">-- Dean</div></div>
</div>
<br class=""></body></html>