From 6d087191348404954033c4a1ec2fa7df19705d3d Mon Sep 17 00:00:00 2001 From: DiFFoZ <48765566+DiFFoZ@users.noreply.github.com> Date: Thu, 13 Oct 2022 01:38:39 +0700 Subject: [PATCH] Dispose ActionThread --- Dummy/Threads/DummyUserActionThread.cs | 3 ++- Dummy/Users/DummyUser.cs | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dummy/Threads/DummyUserActionThread.cs b/Dummy/Threads/DummyUserActionThread.cs index e06a70e..2f11b69 100644 --- a/Dummy/Threads/DummyUserActionThread.cs +++ b/Dummy/Threads/DummyUserActionThread.cs @@ -59,10 +59,11 @@ public async UniTask Start() } } - public async ValueTask DisposeAsync() + public ValueTask DisposeAsync() { Enabled = false; GC.SuppressFinalize(this); + return new(); } } } \ No newline at end of file diff --git a/Dummy/Users/DummyUser.cs b/Dummy/Users/DummyUser.cs index bfb2b61..513a019 100644 --- a/Dummy/Users/DummyUser.cs +++ b/Dummy/Users/DummyUser.cs @@ -83,14 +83,14 @@ async UniTask PrintMessageTask() return PrintMessageTask().AsTask(); } - public ValueTask DisposeAsync() + public async ValueTask DisposeAsync() { - Actions.Enabled = false; + await Actions.DisposeAsync(); Simulation.Enabled = false; if (Session == null) { - return new(); + return; } if (Session is UnturnedUserSession session) @@ -98,7 +98,7 @@ public ValueTask DisposeAsync() session.OnSessionEnd(); } - return new(Session!.DisconnectAsync()); + await Session!.DisconnectAsync(); } public bool Equals(DummyUser other)