Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Remove SpinWait #132

Merged
merged 1 commit into from
Nov 27, 2018
Merged

Remove SpinWait #132

merged 1 commit into from
Nov 27, 2018

Conversation

mrward
Copy link
Member

@mrward mrward commented Nov 26, 2018

Use Task.Wait instead to avoid CPU use.

Use Task.Wait instead to avoid CPU use.
@@ -643,8 +643,7 @@ internal string DownloadFile (IProgressMonitor monitor, string url)
try {
monitor.BeginTask ("Requesting " + url, 2);
var task = DownloadFileRequest.DownloadFile (url, noCache: true);
if (!WaitForTask (task, monitor))
throw new InstallException ("Installation cancelled.");
task.Wait ();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the cancellation token overload.

@@ -643,8 +643,7 @@ internal string DownloadFile (IProgressMonitor monitor, string url)
try {
monitor.BeginTask ("Requesting " + url, 2);
var task = DownloadFileRequest.DownloadFile (url, noCache: true);
if (!WaitForTask (task, monitor))
throw new InstallException ("Installation cancelled.");
task.Wait ();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, bummer, mono-addins monitor does not use cancellation token.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrward mrward merged commit 74ce91a into master Nov 27, 2018
@mrward mrward deleted the http-client-task-wait branch November 27, 2018 10:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants