-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[wasm] Don't use SyncTextWriter in single-threaded wasm builds #101221
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 |
---|---|---|
|
@@ -22,6 +22,8 @@ | |
<IsBigEndian Condition="'$(Platform)' == 's390x'">true</IsBigEndian> | ||
<Is64Bit Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'x64' or '$(Platform)' == 's390x' or '$(Platform)' == 'loongarch64' or '$(Platform)' == 'ppc64le' or '$(Platform)' == 'riscv64'">true</Is64Bit> | ||
<UseMinimalGlobalizationData Condition="'$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true'">true</UseMinimalGlobalizationData> | ||
<FeatureWasmManagedThreads Condition="'$(WasmEnableThreads)' == 'true'">true</FeatureWasmManagedThreads> | ||
<DefineConstants Condition="'$(FeatureWasmManagedThreads)' == 'true'">$(DefineConstants);FEATURE_WASM_MANAGED_THREADS</DefineConstants> | ||
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. this duplicates the conditions from src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj, I don't think we need them here |
||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DefineConstants Condition="'$(IsBigEndian)' == 'true'">$(DefineConstants);BIGENDIAN</DefineConstants> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -759,7 +759,11 @@ public static TextWriter Synchronized(TextWriter writer) | |
{ | ||
ArgumentNullException.ThrowIfNull(writer); | ||
|
||
#if !TARGET_BROWSER || FEATURE_WASM_MANAGED_THREADS | ||
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. should also check for WASI |
||
return writer is SyncTextWriter ? writer : new SyncTextWriter(writer); | ||
#else | ||
return writer; | ||
#endif | ||
} | ||
|
||
internal sealed class SyncTextWriter : TextWriter, IDisposable | ||
|
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.
this should use
PlatformDetection.IsThreadingSupported
too instead of checking for browser so it applies to single-threaded wasi too