Skip to content

Commit 48db895

Browse files
committed
Rename semaphore to _semaphore
1 parent a25a702 commit 48db895

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Enyim.Caching/Memcached/MemcachedNode.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ private class InternalPoolImpl : IDisposable
275275
private MemcachedNode ownerNode;
276276
private readonly EndPoint _endPoint;
277277
private readonly TimeSpan queueTimeout;
278-
private SemaphoreSlim semaphore;
278+
private SemaphoreSlim _semaphore;
279279

280280
private readonly object initLock = new Object();
281281

@@ -299,7 +299,7 @@ internal InternalPoolImpl(
299299
this.minItems = config.MinPoolSize;
300300
this.maxItems = config.MaxPoolSize;
301301

302-
this.semaphore = new SemaphoreSlim(maxItems, maxItems);
302+
_semaphore = new SemaphoreSlim(maxItems, maxItems);
303303
this.freeItems = new InterlockedStack<PooledSocket>();
304304

305305
_logger = logger;
@@ -410,7 +410,7 @@ public IPooledSocketResult Acquire()
410410

411411
PooledSocket retval = null;
412412

413-
if (!this.semaphore.Wait(this.queueTimeout))
413+
if (!_semaphore.Wait(this.queueTimeout))
414414
{
415415
message = "Pool is full, timeouting. " + _endPoint;
416416
if (_isDebugEnabled) _logger.LogDebug(message);
@@ -481,7 +481,7 @@ public IPooledSocketResult Acquire()
481481
// so we need to make sure to release the semaphore, so new connections can be
482482
// acquired or created (otherwise dead conenctions would "fill up" the pool
483483
// while the FP pretends that the pool is healthy)
484-
semaphore.Release();
484+
_semaphore.Release();
485485

486486
this.MarkAsDead();
487487
result.Fail(message);
@@ -516,7 +516,7 @@ public async Task<IPooledSocketResult> AcquireAsync()
516516

517517
PooledSocket retval = null;
518518

519-
if (!await this.semaphore.WaitAsync(this.queueTimeout))
519+
if (!await _semaphore.WaitAsync(this.queueTimeout))
520520
{
521521
message = "Pool is full, timeouting. " + _endPoint;
522522
if (_isDebugEnabled) _logger.LogDebug(message);
@@ -588,7 +588,7 @@ public async Task<IPooledSocketResult> AcquireAsync()
588588
// so we need to make sure to release the semaphore, so new connections can be
589589
// acquired or created (otherwise dead conenctions would "fill up" the pool
590590
// while the FP pretends that the pool is healthy)
591-
semaphore.Release();
591+
_semaphore.Release();
592592

593593
this.MarkAsDead();
594594
result.Fail(message);
@@ -647,9 +647,9 @@ private void ReleaseSocket(PooledSocket socket)
647647
finally
648648
{
649649
// signal the event so if someone is waiting for it can reuse this item
650-
if (this.semaphore != null)
650+
if (_semaphore != null)
651651
{
652-
this.semaphore.Release();
652+
_semaphore.Release();
653653
}
654654
}
655655
}
@@ -667,9 +667,9 @@ private void ReleaseSocket(PooledSocket socket)
667667
{
668668
// make sure to signal the Acquire so it can create a new conenction
669669
// if the failure policy keeps the pool alive
670-
if (this.semaphore != null)
670+
if (_semaphore != null)
671671
{
672-
this.semaphore.Release();
672+
_semaphore.Release();
673673
}
674674
}
675675
}
@@ -684,9 +684,9 @@ private void ReleaseSocket(PooledSocket socket)
684684
}
685685
finally
686686
{
687-
if (this.semaphore != null)
687+
if (_semaphore != null)
688688
{
689-
this.semaphore.Release();
689+
_semaphore.Release();
690690
}
691691
}
692692
}
@@ -722,8 +722,8 @@ public void Dispose()
722722
}
723723

724724
this.ownerNode = null;
725-
this.semaphore.Dispose();
726-
this.semaphore = null;
725+
_semaphore.Dispose();
726+
_semaphore = null;
727727
this.freeItems = null;
728728
}
729729
}

0 commit comments

Comments
 (0)