Repository navigation
[browser][wasi] Allow uncontended synchronous waits #135335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3157,8 +3157,6 @@ private bool InternalWaitCore(int millisecondsTimeout, CancellationToken cancell | |||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| RuntimeFeature.ThrowIfMultithreadingIsNotSupported(); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| returnValue = SpinThenBlockingWait(millisecondsTimeout, cancellationToken); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
@@ -3212,7 +3210,7 @@ private bool SpinThenBlockingWait(int millisecondsTimeout, CancellationToken can | |||||||||||||||||||||||||||||||||
| bool infiniteWait = millisecondsTimeout == Timeout.Infinite; | ||||||||||||||||||||||||||||||||||
| uint startTimeTicks = infiniteWait ? 0 : (uint)Environment.TickCount; | ||||||||||||||||||||||||||||||||||
| bool returnValue = SpinWait(millisecondsTimeout); | ||||||||||||||||||||||||||||||||||
| if (!returnValue) | ||||||||||||||||||||||||||||||||||
| if (!returnValue && (millisecondsTimeout != 0 || RuntimeFeature.IsMultithreadingSupported)) | ||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| RuntimeFeature.ThrowIfMultithreadingIsNotSupported(); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
Comment on lines
3215
to
3216
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||
|
|
@@ -5175,10 +5173,17 @@ private static bool WaitAllCore(ReadOnlySpan<Task> tasks, int millisecondsTimeou | |||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (waitedOnTaskList != null) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| RuntimeFeature.ThrowIfMultithreadingIsNotSupported(); | ||||||||||||||||||||||||||||||||||
| if (millisecondsTimeout != 0 || RuntimeFeature.IsMultithreadingSupported) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| RuntimeFeature.ThrowIfMultithreadingIsNotSupported(); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+5176
to
+5178
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Block waiting for the tasks to complete. | ||||||||||||||||||||||||||||||||||
| returnValue = WaitAllBlockingCore(waitedOnTaskList, millisecondsTimeout, cancellationToken); | ||||||||||||||||||||||||||||||||||
| // Block waiting for the tasks to complete. | ||||||||||||||||||||||||||||||||||
| returnValue = WaitAllBlockingCore(waitedOnTaskList, millisecondsTimeout, cancellationToken); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| returnValue = false; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // If the wait didn't time out, ensure exceptions are propagated, and if a debugger is | ||||||||||||||||||||||||||||||||||
| // attached and one of these tasks requires it, that we notify the debugger of a wait completion. | ||||||||||||||||||||||||||||||||||
|
|
@@ -5515,7 +5520,9 @@ private static int WaitAnyCore(Task[] tasks, int millisecondsTimeout, Cancellati | |||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (signaledTaskIndex == -1 && tasks.Length != 0) | ||||||||||||||||||||||||||||||||||
| if (signaledTaskIndex == -1 && | ||||||||||||||||||||||||||||||||||
| tasks.Length != 0 && | ||||||||||||||||||||||||||||||||||
| (millisecondsTimeout != 0 || RuntimeFeature.IsMultithreadingSupported)) | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+5523
to
+5525
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| RuntimeFeature.ThrowIfMultithreadingIsNotSupported(); | ||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!RuntimeFeature.IsMultithreadingSupported)in SpinWait can be deleted or replaced by assert.