mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 14:46:38 +09:00
Add RealmAccess.WriteAsync
method
This commit is contained in:
@ -8,6 +8,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Input.Bindings;
|
||||
@ -270,6 +271,17 @@ namespace osu.Game.Database
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write changes to realm asynchronously, guaranteeing order of execution.
|
||||
/// </summary>
|
||||
/// <param name="action">The work to run.</param>
|
||||
public async Task WriteAsync(Action<Realm> action)
|
||||
{
|
||||
total_writes_async.Value++;
|
||||
using (var realm = getRealmInstance())
|
||||
await realm.WriteAsync(action);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Subscribe to a realm collection and begin watching for asynchronous changes.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user