[Webkit-unassigned] [Bug 25348] New: Change WTF::ThreadIdentifier to be an actual (but wrapped) thread id, remove ThreadMap.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 23 14:13:10 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=25348

           Summary: Change WTF::ThreadIdentifier to be an actual (but
                    wrapped) thread id, remove ThreadMap.
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: dimich at chromium.org
                CC: ap at webkit.org


WTF defines ThreadIdentifier as a platform-independent thread ID. It does it by
keeping platform-dependent ThreadMap which maps native thread IDs into
sequential integers. The mapping happens 'opportunistically', either when
thread is created via WTF or when currentThread() is called first time on a
thread that was not created via WTF. The mapping is removed when (and if)
WTF::detachThread(threadID) is called.

These mappings may leak and get out of sync because detachThread() is not
enforced in any way, on some platforms has empty implementation, and if some
code (like destructors of thread-specific data) runs after detachThread is
invoked, it creates a new mapping which is never removed. See bug 25138 for
particular scenario.

Solution:
Remove ThreadMap and all the mappings. Make ThreadIdentifier a wrapper around
platform-specific thread ID which implements comparison operators needed in the
code. Fortunately, all platform thread IDs are either integers or opaque
pointers so the ThreadIdentifier is easily copyable. This simplifies the code
because there is not need to maintain mappings, and makes ThreadIdentifier
valid even while running pthread's thread-specific destructors.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list