Bug 177729

Summary: Use ThreadIdentifier instead of thread::this_thread::get_id
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch sam: review+

Description Yusuke Suzuki 2017-10-01 17:06:38 PDT
Use ThreadIdentifier instead of thread::this_thread::get_id
Comment 1 Yusuke Suzuki 2017-10-01 17:07:14 PDT
Created attachment 322338 [details]
Patch
Comment 2 Sam Weinig 2017-10-01 17:26:31 PDT
Comment on attachment 322338 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322338&action=review

> Source/WebCore/ChangeLog:8
> +        We can use WTF::ThreadIdentifier instead of thread::this_thread::get_id.

Can you explain why this is preferable? I assume it is more efficient.
Comment 3 Yusuke Suzuki 2017-10-02 01:16:38 PDT
Comment on attachment 322338 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322338&action=review

I'll fix build failure by including <wtf/Threading.h>

>> Source/WebCore/ChangeLog:8
>> +        We can use WTF::ThreadIdentifier instead of thread::this_thread::get_id.
> 
> Can you explain why this is preferable? I assume it is more efficient.

There are two reasons,

1. thread::this_thread::get_id is slower in Windows
2. using ThreadIdentifier is consistent to the other code in WebKit. Other part of WebKit just uses ThreadIdentifier for the exact same purpose (debugging threadID). Only this place uses thread::this_thread::get_id.
Comment 4 Yusuke Suzuki 2017-10-02 01:18:58 PDT
Created attachment 322361 [details]
Patch
Comment 5 Sam Weinig 2017-10-02 10:19:26 PDT
Comment on attachment 322361 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322361&action=review

> Source/WebCore/ChangeLog:8
> +        We can use WTF::ThreadIdentifier instead of thread::this_thread::get_id.

Please put your more detailed explanation of why in the ChangeLog.
Comment 6 Yusuke Suzuki 2017-10-02 10:37:58 PDT
Comment on attachment 322361 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322361&action=review

>> Source/WebCore/ChangeLog:8
>> +        We can use WTF::ThreadIdentifier instead of thread::this_thread::get_id.
> 
> Please put your more detailed explanation of why in the ChangeLog.

Thanks, I've just added these explanation to this ChangeLog :)
Comment 7 Yusuke Suzuki 2017-10-02 10:53:00 PDT
Committed r222719: <http://trac.webkit.org/changeset/222719>
Comment 8 Radar WebKit Bug Importer 2017-10-02 10:54:12 PDT
<rdar://problem/34770618>