From c765785d001b13a58e483b61600fbf5eaad916bb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Oct 2017 11:42:55 +0900 Subject: [PATCH] Mark several long-running tasks as long-running --- osu.Desktop/OsuGameDesktop.cs | 2 +- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- .../Overlays/Settings/Sections/Maintenance/GeneralSettings.cs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 5f05fae213..990dc789e6 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -106,7 +106,7 @@ private void fileDrop(object sender, FileDropEventArgs e) var filePaths = new [] { e.FileName }; if (filePaths.All(f => Path.GetExtension(f) == @".osz")) - Task.Run(() => BeatmapManager.Import(filePaths)); + Task.Factory.StartNew(() => BeatmapManager.Import(filePaths), TaskCreationOptions.LongRunning); else if (filePaths.All(f => Path.GetExtension(f) == @".osr")) Task.Run(() => { diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 55c3e192e3..f03531aba8 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -272,7 +272,7 @@ public DownloadBeatmapSetRequest Download(BeatmapSetInfo beatmapSetInfo) PostNotification?.Invoke(downloadNotification); // don't run in the main api queue as this is a long-running task. - Task.Run(() => request.Perform(api)); + Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning); return request; } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index 316be450dc..4c82a9ae4b 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -29,7 +29,8 @@ private void load(BeatmapManager beatmaps) Action = () => { importButton.Enabled.Value = false; - Task.Run(() => beatmaps.ImportFromStable()).ContinueWith(t => Schedule(() => importButton.Enabled.Value = true)); + Task.Factory.StartNew(beatmaps.ImportFromStable) + .ContinueWith(t => Schedule(() => importButton.Enabled.Value = true), TaskContinuationOptions.LongRunning); } }, deleteButton = new SettingsButton