[webkit-reviews] review requested: [Bug 25973] Avoid calling WTF::CurrentThread() from thread-local destructors in Chromium on OSX : [Attachment 30686] Updated patch.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 26 16:37:52 PDT 2009


Dmitry Titov <dimich at chromium.org> has asked  for review:
Bug 25973: Avoid calling WTF::CurrentThread() from thread-local destructors in
Chromium on OSX
https://bugs.webkit.org/show_bug.cgi?id=25973

Attachment 30686: Updated patch.
https://bugs.webkit.org/attachment.cgi?id=30686&action=review

------- Additional Comments from Dmitry Titov <dimich at chromium.org>
A better patch and a bit better attempt to explain the change:

Pthreads invoke thread-specific destructors after WTF::detachThread() is called
and ThreadIdentifier
for the thread removed from the WTF thread map. Calling CurrentThread() in such
destructor causes
the ThreadIdentifier to be re-created and inserted into the map again. Since
Pthreads on OSX reuse
the pthread_t between threads, the next created thread will have the same
pthread_t and cause an assert in establishIdentifierForPthreadHandle() since
the id is already in the map.

The change removes the call to isMainThread() which internally calls
CurrentThread() in OSX Chromium port, by storing the result of isMainThread()
in a member variable of thread-specific data during construction. Since
destructor of thread-specific data is always called on its 'own' thread, the
change preserves the previous behavior but fixes the aforementioned problem.

The behavior is covered by existing test
LayoutTests/fast/workers/worker-terminate.html, which currently fails on OSX
Chromium and will stop failing after this change.


More information about the webkit-reviews mailing list