架构大更

This commit is contained in:
SoulliesOfficial
2026-03-20 11:56:50 -04:00
parent e60ef64d01
commit d09b58fd80
3663 changed files with 15232012 additions and 105579 deletions

View File

@@ -1,25 +1,13 @@
using System;
using System.Collections;
namespace UniRx
{
public sealed class MultipleAssignmentDisposable : IDisposable, ICancelable
{
static readonly BooleanDisposable True = new BooleanDisposable(true);
private static readonly BooleanDisposable True = new(true);
private IDisposable current;
object gate = new object();
IDisposable current;
public bool IsDisposed
{
get
{
lock (gate)
{
return current == True;
}
}
}
private readonly object gate = new();
public IDisposable Disposable
{
@@ -27,7 +15,7 @@ namespace UniRx
{
lock (gate)
{
return (current == True)
return current == True
? UniRx.Disposable.Empty
: current;
}
@@ -37,15 +25,21 @@ namespace UniRx
var shouldDispose = false;
lock (gate)
{
shouldDispose = (current == True);
if (!shouldDispose)
{
current = value;
}
shouldDispose = current == True;
if (!shouldDispose) current = value;
}
if (shouldDispose && value != null)
if (shouldDispose && value != null) value.Dispose();
}
}
public bool IsDisposed
{
get
{
lock (gate)
{
value.Dispose();
return current == True;
}
}
}