提交 ebf71c2c 编写于 作者: P Paul Harrington

Renamed AsyncSemaphore to SemaphoreSlimFactory

上级 2823cec7
......@@ -8,11 +8,11 @@ namespace Roslyn.Utilities
/// <summary>
/// Container for a <see cref="SemaphoreSlim"/> factory.
/// </summary>
internal static class AsyncSemaphore
internal static class SemaphoreSlimFactory
{
/// <summary>
/// Factory object that may be used for lazy initialization. Creates AsyncSemaphore instances with an initial count of 1.
/// </summary>
public static readonly Func<SemaphoreSlim> Factory = () => new SemaphoreSlim(initialCount: 1);
public static readonly Func<SemaphoreSlim> Instance = () => new SemaphoreSlim(initialCount: 1);
}
}
......@@ -27,7 +27,7 @@ public CachedWeakValueSource(ValueSource<T> source)
_reference = s_noReference;
}
private SemaphoreSlim Gate => LazyInitialization.EnsureInitialized(ref _gateDoNotAccessDirectly, AsyncSemaphore.Factory);
private SemaphoreSlim Gate => LazyInitialization.EnsureInitialized(ref _gateDoNotAccessDirectly, SemaphoreSlimFactory.Instance);
public override bool TryGetValue(out T value)
{
......
......@@ -62,7 +62,7 @@ public RecoverableWeakValueSource(RecoverableWeakValueSource<T> savedSource)
private static Task s_latestTask = SpecializedTasks.EmptyTask;
private static readonly NonReentrantLock s_taskGuard = new NonReentrantLock();
private SemaphoreSlim Gate => LazyInitialization.EnsureInitialized(ref _gateDoNotAccessDirectly, AsyncSemaphore.Factory);
private SemaphoreSlim Gate => LazyInitialization.EnsureInitialized(ref _gateDoNotAccessDirectly, SemaphoreSlimFactory.Instance);
public override bool TryGetValue(out T value)
{
......
......@@ -32,7 +32,7 @@ internal class RecoverableTextAndVersion : ValueSource<TextAndVersion>, ITextVer
_storageService = storageService;
}
private SemaphoreSlim Gate => LazyInitialization.EnsureInitialized(ref _gateDoNotAccessDirectly, AsyncSemaphore.Factory);
private SemaphoreSlim Gate => LazyInitialization.EnsureInitialized(ref _gateDoNotAccessDirectly, SemaphoreSlimFactory.Instance);
public override bool TryGetValue(out TextAndVersion value)
{
......
......@@ -773,7 +773,7 @@
<Compile Include="Utilities\AbstractSpeculationAnalyzer.cs" />
<Compile Include="Utilities\AnnotationTable.cs" />
<Compile Include="Utilities\AsyncLazy`1.cs" />
<Compile Include="Utilities\AsyncSemaphore.cs" />
<Compile Include="Utilities\SemaphoreSlimFactory.cs" />
<Compile Include="Utilities\BidirectionalMap.cs" />
<Compile Include="Utilities\CancellableLazy.cs" />
<Compile Include="Utilities\CancellableLazy`1.cs" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册