Skip to content

Commit

Permalink
Add update thread asserts to RoomManager methods
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Dec 10, 2021
1 parent 3633494 commit 970a9ae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions osu.Game/Screens/OnlinePlay/Components/RoomManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Development;
using osu.Framework.Graphics;
using osu.Framework.Logging;
using osu.Game.Online.API;
using osu.Game.Online.Rooms;
using osu.Game.Rulesets;
using osu.Game.Utils;

namespace osu.Game.Screens.OnlinePlay.Components
{
Expand Down Expand Up @@ -107,6 +109,7 @@ public virtual void PartRoom()

public void AddOrUpdateRoom(Room room)
{
Debug.Assert(ThreadSafety.IsUpdateThread);
Debug.Assert(room.RoomID.Value != null);

if (ignoredRooms.Contains(room.RoomID.Value.Value))
Expand Down Expand Up @@ -136,12 +139,16 @@ public void AddOrUpdateRoom(Room room)

public void RemoveRoom(Room room)
{
Debug.Assert(ThreadSafety.IsUpdateThread);

rooms.Remove(room);
notifyRoomsUpdated();
}

public void ClearRooms()
{
Debug.Assert(ThreadSafety.IsUpdateThread);

rooms.Clear();
notifyRoomsUpdated();
}
Expand Down

0 comments on commit 970a9ae

Please sign in to comment.