public static bool TryRelease(SemaphoreSlimSafeRelease semaphore, int releaseCount)
		{
			try
			{
				if (IsAlive(semaphore))
				{
					semaphore.Release(releaseCount);
					return true;
				}
			}
			catch { }
			return false;
		}
Beispiel #2
0
 public static bool TryRelease(SemaphoreSlimSafeRelease semaphore, int releaseCount)
 {
     try
     {
         if (IsAlive(semaphore))
         {
             semaphore.Release(releaseCount);
             return(true);
         }
     }
     catch { }
     return(false);
 }
		public static bool TryRelease(SemaphoreSlimSafeRelease semaphore)
		{
			try
			{
				// the following commented out stuff wouldbe nice to avoid the exception but it is not atomic, so we leave it.
				if (IsAlive(semaphore) /*&& semaphore.CurrentCount < semaphore._maxCount*/)
				{
					semaphore.Release();
					return true;
				}
			}
			catch { }
			return false;
		}
Beispiel #4
0
 public static bool TryRelease(SemaphoreSlimSafeRelease semaphore)
 {
     try
     {
         // the following commented out stuff wouldbe nice to avoid the exception but it is not atomic, so we leave it.
         if (IsAlive(semaphore) /*&& semaphore.CurrentCount < semaphore._maxCount*/)
         {
             semaphore.Release();
             return(true);
         }
     }
     catch { }
     return(false);
 }