<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 31, 2019 at 8:54 AM Ed Maste via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org">libcxx-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">We just had a FreeBSD bug submitted for a failure arising from<br>
libc++'s use of pthread_equal.<br>
<br>
FreeBSD's pthread_equal stub implementation (used in non-threaded<br>
programs) returns true unconditionally, since a non-threaded program<br>
cannot have two different threads. However, std::thread::id defines a<br>
special value that should not equal any real thread, and this is may<br>
be passed to pthread_equal. See FreeBSD PR 239550 for more details,<br>
and PR 239038 for the user-facing issue that prompted this.<br>
<br>
<a href="https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239550" rel="noreferrer" target="_blank">https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239550</a><br>
<a href="https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239038" rel="noreferrer" target="_blank">https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239038</a><br>
<br>
Now the most expedient fix is probably for us to make pthread_equal<br>
somewhat less of a stub, but for correctness it seems<br>
__libcpp_thread_id_equal would need to check for libc++'s special<br>
value before calling pthread_equal.<br></blockquote><div><br></div><div>Written up as bug <a href="https://bugs.llvm.org/show_bug.cgi?id=42918">https://bugs.llvm.org/show_bug.cgi?id=42918</a></div><div><br></div><div>-- Marshall </div></div></div>