1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 18:20:34 +08:00
osu-lazer/osu.Game/Online/RealtimeMultiplayer/LockUntilDisposal.cs

25 lines
597 B
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Threading;
namespace osu.Game.Online.RealtimeMultiplayer
{
public readonly struct LockUntilDisposal : IDisposable
{
private readonly object lockTarget;
public LockUntilDisposal(object lockTarget)
{
this.lockTarget = lockTarget;
Monitor.Enter(lockTarget);
}
public void Dispose()
{
Monitor.Exit(lockTarget);
}
}
}