diff --git a/demo/OneWare.Demo.Browser/OneWare.Demo.Browser.csproj b/demo/OneWare.Demo.Browser/OneWare.Demo.Browser.csproj index c78b3023..1cc70c24 100644 --- a/demo/OneWare.Demo.Browser/OneWare.Demo.Browser.csproj +++ b/demo/OneWare.Demo.Browser/OneWare.Demo.Browser.csproj @@ -10,13 +10,12 @@ AppBundle\main.js Exe true - true - threads-release - --> + <_WasmAppIncludeThreadsWorker>true + <_WasmPThreadPoolSize>8 @@ -27,8 +26,6 @@ full true true - -O2 - -O2 @@ -40,6 +37,7 @@ + diff --git a/demo/OneWare.Demo.Browser/Program.cs b/demo/OneWare.Demo.Browser/Program.cs index 76fbb8db..01c7fbfc 100644 --- a/demo/OneWare.Demo.Browser/Program.cs +++ b/demo/OneWare.Demo.Browser/Program.cs @@ -13,10 +13,14 @@ internal partial class Program { public static async Task Main(string[] args) { +#if DEBUG Trace.Listeners.Add(new ConsoleTraceListener()); +#endif await BuildAvaloniaApp() + #if DEBUG .LogToTrace() + #endif .StartBrowserAppAsync("out"); } diff --git a/src/OneWare.Core/ViewModels/DockViews/EditViewModel.cs b/src/OneWare.Core/ViewModels/DockViews/EditViewModel.cs index 27ca4090..b5d69961 100644 --- a/src/OneWare.Core/ViewModels/DockViews/EditViewModel.cs +++ b/src/OneWare.Core/ViewModels/DockViews/EditViewModel.cs @@ -325,7 +325,7 @@ private async Task LoadAsync() await using var stream = File.OpenRead(CurrentFile.FullPath); using var reader = new StreamReader(stream); - var doc = await PlatformHelper.RunTask(() => + var doc = await Task.Run(() => { var d = new TextDocument(reader.ReadToEnd()); d.SetOwnerThread(null); diff --git a/src/OneWare.Shared/Helpers/PlatformHelper.cs b/src/OneWare.Shared/Helpers/PlatformHelper.cs index 26e795d2..ee02eb80 100644 --- a/src/OneWare.Shared/Helpers/PlatformHelper.cs +++ b/src/OneWare.Shared/Helpers/PlatformHelper.cs @@ -126,15 +126,6 @@ public static void OpenExplorerPath(string path) ContainerLocator.Container.Resolve().Error("Can't open " + path + " in explorer. " + e, e, true, true); } } - - public static Task RunTask(Func function) - { - if (RuntimeInformation.OSArchitecture is Architecture.Wasm) - { - return Task.FromResult(function.Invoke()); - } - else return Task.Run(function); - } #region File Management diff --git a/src/OneWare.Vcd.Parser/VcdParser.cs b/src/OneWare.Vcd.Parser/VcdParser.cs index 6a9823ce..dd9422d9 100644 --- a/src/OneWare.Vcd.Parser/VcdParser.cs +++ b/src/OneWare.Vcd.Parser/VcdParser.cs @@ -32,7 +32,7 @@ public static async Task ReadSignalsAsync(string path, VcdFile vcdFile, IProgres //Use thread safe variant if (threads == 1) { - async Task ReadSignalsLocal() + await Task.Run(async () => { await using var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.ReadWrite); stream.Seek(vcdFile.DefinitionParseEndPosition+1, SeekOrigin.Begin); @@ -42,10 +42,7 @@ await ReadSignals(reader, vcdFile.Definition.SignalRegister, vcdFile.Definition. cancellationToken); if(!cancellationToken.IsCancellationRequested) await Task.Delay(1, cancellationToken); reader.Dispose(); - } - - if (RuntimeInformation.OSArchitecture is Architecture.Wasm) _ = ReadSignalsLocal(); - else await Task.Run(() => _ = ReadSignalsLocal()); + }); return; } @@ -210,7 +207,7 @@ private static VcdFile ReadDefinition(TextReader reader) stream.Seek(-backOffset, SeekOrigin.End); using var reader = new StreamReader(stream); - var text = RuntimeInformation.OSArchitecture is Architecture.Wasm ? reader.ReadToEnd() : await reader.ReadToEndAsync(); + var text = await reader.ReadToEndAsync(); var lines = text.Split('\n'); var lastTime = lines.LastOrDefault(x => x.StartsWith('#')); diff --git a/src/OneWare.Vhdl/LanguageServiceVhdl.cs b/src/OneWare.Vhdl/LanguageServiceVhdl.cs index 138eb553..aa443d89 100644 --- a/src/OneWare.Vhdl/LanguageServiceVhdl.cs +++ b/src/OneWare.Vhdl/LanguageServiceVhdl.cs @@ -25,7 +25,7 @@ static LanguageServiceVhdl() { PlatformId.WinX64 => $"{assemblyPath}/native_tools/win-x64/rusthdl/vhdl_ls-x86_64-pc-windows-msvc/bin/vhdl_ls.exe", PlatformId.LinuxX64 => $"{assemblyPath}/native_tools/linux-x64/rusthdl/vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls", - PlatformId.Wasm => "wss://oneware-cloud-ls-vhdl-qtuhvc77rq-ew.a.run.app", + //PlatformId.Wasm => "wss://oneware-cloud-ls-vhdl-qtuhvc77rq-ew.a.run.app", _ => null }; }