Pull out thread local contexts and have main realm refresh in update loop

This commit is contained in:
Dean Herbert
2021-01-13 17:34:44 +09:00
parent 78707c3b06
commit 542f535247
3 changed files with 53 additions and 53 deletions

View File

@ -7,10 +7,18 @@ namespace osu.Game.Database
{
public interface IRealmFactory
{
Realm Get();
/// <summary>
/// The main realm context, bound to the update thread.
/// </summary>
public Realm Context { get; }
/// <summary>
/// Request a context for write usage. Can be consumed in a nested fashion (and will return the same underlying context).
/// Get a fresh context for read usage.
/// </summary>
Realm GetForRead();
/// <summary>
/// Request a context for write usage.
/// This method may block if a write is already active on a different thread.
/// </summary>
/// <returns>A usage containing a usable context.</returns>