Added a proper async context to Run(), renamed parameter-less Run to Wait

This commit is contained in:
RogueException
2016-01-06 04:16:54 -04:00
parent 0e68d190b4
commit 934bfebc9b

View File

@@ -1052,13 +1052,13 @@ namespace Discord
{ {
try try
{ {
asyncAction().GetAwaiter().GetResult(); //Avoids creating AggregateExceptions AsyncContext.Run(asyncAction);
} }
catch (TaskCanceledException) { } catch (TaskCanceledException) { }
_disconnectedEvent.WaitOne(); _disconnectedEvent.WaitOne();
} }
/// <summary> Blocking call that will not return until client has been stopped. This is mainly intended for use in console applications. </summary> /// <summary> Blocking call that will not return until client has been stopped. This is mainly intended for use in console applications. </summary>
public void Run() public void Wait()
{ {
_disconnectedEvent.WaitOne(); _disconnectedEvent.WaitOne();
} }