Skip to content

Commit

Permalink
Replace Delegate.BeginInvoke with Task.Run
Browse files Browse the repository at this point in the history
Delegate.BeginInvoke was removed in .NET Core.
See dotnet/runtime#16312.
  • Loading branch information
0xC0000054 committed May 8, 2020
1 parent 96911e9 commit df46a44
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/GmicRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System;
using System.ComponentModel;
using System.Threading;
using System.Threading.Tasks;

namespace GmicSharp
{
Expand All @@ -22,18 +23,14 @@ internal sealed class GmicRunner
#pragma warning disable IDE0032 // Use auto property
private bool isRunning;
#pragma warning restore IDE0032 // Use auto property
private readonly GmicWorkerDelegate workerDelegate;
private readonly SendOrPostCallback workerCompleted;

private float progress;
private byte shouldAbort;

private delegate void GmicWorkerDelegate(GmicWorkerArgs args);

public GmicRunner()
{
asyncOperation = null;
workerDelegate = new GmicWorkerDelegate(GmicWorker);
workerCompleted = new SendOrPostCallback(GmicWorkerCompleted);
}

Expand Down Expand Up @@ -78,7 +75,7 @@ public void Start(string command,
imageList,
token,
hasProgressEvent);
workerDelegate.BeginInvoke(args, null, null);
Task.Run(() => GmicWorker(args), token);
}

private unsafe void GmicWorker(GmicWorkerArgs args)
Expand Down

0 comments on commit df46a44

Please sign in to comment.