Bug 180591 - Remove pthread_once in favor of dispatch_once
Summary: Remove pthread_once in favor of dispatch_once
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-12-08 11:34 PST by Yusuke Suzuki
Modified: 2017-12-08 12:18 PST (History)
7 users (show)

See Also:


Attachments
Patch (34.83 KB, patch)
2017-12-08 11:36 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (34.83 KB, patch)
2017-12-08 11:37 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (14.70 KB, patch)
2017-12-08 11:48 PST, Yusuke Suzuki
saam: 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-12-08 11:34:10 PST
Use std::call_once instead of pthread_once_xxx
Comment 1 Yusuke Suzuki 2017-12-08 11:36:27 PST
Created attachment 328840 [details]
Patch
Comment 2 Yusuke Suzuki 2017-12-08 11:37:41 PST
Created attachment 328842 [details]
Patch
Comment 3 Anders Carlsson 2017-12-08 11:38:12 PST
For macOS/iOS specific files you should use dispatch_once instead, it's slightly faster IIRC.
Comment 4 Yusuke Suzuki 2017-12-08 11:39:11 PST
(In reply to Anders Carlsson from comment #3)
> For macOS/iOS specific files you should use dispatch_once instead, it's
> slightly faster IIRC.

Oh, nice. I'll follow this.
Comment 5 EWS Watchlist 2017-12-08 11:40:49 PST
Attachment 328842 [details] did not pass style-queue:


ERROR: Source/WebKitLegacy/mac/Misc/WebKitErrors.mm:31:  Bad include order. Mixing system and custom headers.  [build/include_order] [4]
ERROR: Source/WebKitLegacy/mac/Misc/WebKitErrors.mm:96:  This { should be at the end of the previous line  [whitespace/braces] [4]
ERROR: Source/WebKitLegacy/mac/Misc/WebKitErrors.mm:112:  This { should be at the end of the previous line  [whitespace/braces] [4]
ERROR: Source/WebKitLegacy/mac/Misc/WebKitErrors.mm:128:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
ERROR: Source/WebKitLegacy/mac/Misc/WebKitErrors.mm:129:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebKitLegacy/mac/Misc/WebKitErrors.mm:131:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebKitLegacy/mac/Misc/WebKitErrors.mm:132:  This { should be at the end of the previous line  [whitespace/braces] [4]
ERROR: Source/WebKitLegacy/mac/Misc/WebKitErrors.mm:146:  One line control clauses should not use braces.  [whitespace/braces] [4]
ERROR: Source/WebKitLegacy/mac/Misc/WebKitErrors.mm:149:  One line control clauses should not use braces.  [whitespace/braces] [4]
ERROR: Source/WebKitLegacy/mac/Misc/WebKitErrors.mm:152:  One line control clauses should not use braces.  [whitespace/braces] [4]
Total errors found: 10 in 12 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Yusuke Suzuki 2017-12-08 11:48:20 PST
Created attachment 328846 [details]
Patch
Comment 7 Saam Barati 2017-12-08 12:04:31 PST
Comment on attachment 328846 [details]
Patch

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

r=me. Looks like a reasonable cleanup.

> Source/WTF/ChangeLog:3
> +        Remove pthread_once in favor of std::call_once and dispatch_once

You don't actually use std::call_once in this patch anymore :)
Comment 8 Yusuke Suzuki 2017-12-08 12:05:51 PST
Comment on attachment 328846 [details]
Patch

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

Thanks. Now, very limited pthread_xxx is used in WebKit! (basically it is for platform specific pthread extensions like QOS).

>> Source/WTF/ChangeLog:3
>> +        Remove pthread_once in favor of std::call_once and dispatch_once
> 
> You don't actually use std::call_once in this patch anymore :)

Oh, right. Fixed :)
Comment 9 Yusuke Suzuki 2017-12-08 12:17:04 PST
Committed r225692: <https://trac.webkit.org/changeset/225692>
Comment 10 Radar WebKit Bug Importer 2017-12-08 12:18:29 PST
<rdar://problem/35940539>