I'll post a bug and do this. Shouldn't take long.<br><br><div class="gmail_quote">On Tue, Jun 16, 2009 at 8:23 PM, Maciej Stachowiak <span dir="ltr"><<a href="mailto:mjs@apple.com">mjs@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5"><br>
On Jun 6, 2009, at 8:57 AM, Drew Wilson wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I can't seem to find any documentation as to what the expected behavior of Mutex.lock() is with regard to calling lock() recursively on the same thread.<br>
<br>
Looking at the pthreads implementation, it appears that when we create the mutex we pass null as the attributes, which gives us the default behavior (not re-entrant).<br>
<br>
The Windows implementation uses EnterCriticalSection which *is* re-entrant.<br>
<br>
I'm assuming that the pthreads implementation is the correct one (calling Mutex.lock() twice on the same mutex on a single thread should deadlock the thread) but I wanted to verify this since the implementations seem to vary.<br>
</blockquote>
<br></div></div>
The way I would put it is: Mutex.lock() cannot safely be called by a thread already holding the lock. I don't think it makes the implementation "wrong" to allow this to work. But it's true that this could lead developers astray if they only test on platforms where the implementation of Mutex happens to be reentrant. Thus, it would be a good idea to document the fact that reentrancy is not guaranteed, and add ASSERTs to try to check that it is not relied upon.<br>
<br>
Regards,<br><font color="#888888">
Maciej</font><div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
webkit-dev mailing list<br>
<a href="mailto:webkit-dev@lists.webkit.org" target="_blank">webkit-dev@lists.webkit.org</a><br>
<a href="http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev" target="_blank">http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev</a><br>
</div></div></blockquote></div><br>