refactor: 将Framework库和RT、UI放在同一个解决方案中。

This commit is contained in:
SL
2026-06-01 17:48:28 +08:00
parent 1948f4290d
commit b73d39a6b1
4331 changed files with 506148 additions and 49363 deletions
@@ -0,0 +1,62 @@
using System.Collections;
using System.Collections.Generic;
using System.Threading;
namespace Sicentury.Core.Collections
{
public sealed class SafeEnumerator<T> : IEnumerator<T>
{
#region variables
// this is the (thread-unsafe)
// enumerator of the underlying collection
private readonly IEnumerator<T> _enumeratorInner;
// this is the object we shall lock on.
private readonly SemaphoreSlim _semLocker;
#endregion
public SafeEnumerator(IEnumerator<T> inner, SemaphoreSlim semLocker)
{
// entering lock in constructor
//semLocker.Wait();
_semLocker = semLocker;
_enumeratorInner = inner;
}
#region Implementation of IDisposable
public void Dispose()
{
_semLocker.Release();
}
#endregion
#region Implementation of IEnumerator
// we just delegate actual implementation
// to the inner enumerator, that actually iterates
// over some collection
public bool MoveNext()
{
return _enumeratorInner.MoveNext();
}
public void Reset()
{
_enumeratorInner.Reset();
}
public T Current => _enumeratorInner.Current;
object IEnumerator.Current => Current;
#endregion
}
}