Skip to content

Commit

Permalink
Dispose ActionThread
Browse files Browse the repository at this point in the history
  • Loading branch information
DiFFoZ committed Oct 12, 2022
1 parent e8519e0 commit 6d08719
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Dummy/Threads/DummyUserActionThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ public async UniTask Start()
}
}

public async ValueTask DisposeAsync()
public ValueTask DisposeAsync()
{
Enabled = false;
GC.SuppressFinalize(this);
return new();
}
}
}
8 changes: 4 additions & 4 deletions Dummy/Users/DummyUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,22 @@ 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)
{
session.OnSessionEnd();
}

return new(Session!.DisconnectAsync());
await Session!.DisconnectAsync();
}

public bool Equals(DummyUser other)
Expand Down

0 comments on commit 6d08719

Please sign in to comment.