<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><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=""><br>
</div>On FreeBSD and OS X, the underlying pthread_mutex can already do deadlock detection, so I don't see why you'd need to add another word.  The PTHREAD_MUTEX_ERRORCHECK attribute has been part of POSIX since 1997, so I'd expect it to be supported everywhere.<br>
</blockquote><div><br></div><div>PTHREAD_MUTEX_ERRORCHECK detects the deadlock that already happened. <br></div><div>tsan's deadlock detector (as well as helgrind and many other similar tools) detects lock order inversion, i.e. a situation which may potentially lead to a deadlock.</div>
<div><br></div><div>--kcc </div><div> </div></div></div></div>