Added a proper async context to Run(), renamed parameter-less Run to Wait
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user