Currently, we call std::this_thread::yield(), which is super silly. In all other regards, we go to the bare metal for threads. We should use a syscall via a WTF abstraction, rather than using a C++ standard library abstraction.
Created attachment 314950 [details] the.patch I'm still improving this, but it can already be used for yielding experiments.
Comment on attachment 314950 [details] the.patch Actually, I like this approach. R? it is.
Attachment 314950 [details] did not pass style-queue: ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] Total errors found: 2 in 14 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 314950 [details] the.patch View in context: https://bugs.webkit.org/attachment.cgi?id=314950&action=review r=me with comment about windows fix. > Source/WTF/wtf/Threading.cpp:190 > +void Thread::yield() > +{ > + sched_yield(); > +} `sched_yield` is not defined in Windows. So, let's define this in ThreadingPthreads.cpp. And in ThreadingWin.cpp, let's define it with SwitchToThread().
Created attachment 315489 [details] the patch
Created attachment 315492 [details] the patch
Comment on attachment 315492 [details] the patch r- for now because this patch contains a bunch of other stuff that appears to be from the WebKit2->WebKit rename and is therefore hard to review.
Created attachment 315769 [details] the patch This time, without the ridiculousness.
Attachment 315769 [details] did not pass style-queue: ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] ERROR: Source/WTF/wtf/LockAlgorithm.h:125: The parameter name "lock" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/LockAlgorithm.h:131: The parameter name "lock" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/LockAlgorithm.h:131: The parameter name "fairness" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/RunLoopTimer.h:33: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 6 in 32 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 315769 [details] the patch r=me. Looks like you may need to do something for windows
Created attachment 316113 [details] patch for landing
Attachment 316113 [details] did not pass style-queue: ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] ERROR: Source/WTF/wtf/LockAlgorithm.h:125: The parameter name "lock" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/LockAlgorithm.h:131: The parameter name "lock" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/LockAlgorithm.h:131: The parameter name "fairness" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/RunLoopTimer.h:33: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 6 in 32 files If any of these errors are false positives, please file a bug against check-webkit-style.
Landed in https://trac.webkit.org/changeset/219763/webkit