1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 14:42:56 +08:00

Ensure all access to MultiplayerClient.Room is on the update thread

This was an implicit requirement until now, but not well documented
everywhere. Adding this makes it much easier to understand the
requirement (and probably safer).
This commit is contained in:
Dean Herbert 2022-04-08 14:42:54 +09:00
parent d256bd2cc7
commit 9ba99ed57d

View File

@ -11,6 +11,7 @@ using System.Threading;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Development;
using osu.Framework.Graphics;
using osu.Framework.Logging;
using osu.Game.Database;
@ -87,7 +88,21 @@ namespace osu.Game.Online.Multiplayer
/// <summary>
/// The joined <see cref="MultiplayerRoom"/>.
/// </summary>
public MultiplayerRoom? Room { get; private set; }
public MultiplayerRoom? Room
{
get
{
Debug.Assert(ThreadSafety.IsUpdateThread);
return room;
}
private set
{
Debug.Assert(ThreadSafety.IsUpdateThread);
room = value;
}
}
private MultiplayerRoom? room;
/// <summary>
/// The users in the joined <see cref="Room"/> which are participating in the current gameplay loop.