Bug 177729 - Use ThreadIdentifier instead of thread::this_thread::get_id
Summary: Use ThreadIdentifier instead of thread::this_thread::get_id
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-01 17:06 PDT by Yusuke Suzuki
Modified: 2017-10-02 10:54 PDT (History)
2 users (show)

See Also:


Attachments
Patch (3.25 KB, patch)
2017-10-01 17:07 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (3.38 KB, patch)
2017-10-02 01:18 PDT, Yusuke Suzuki
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>