Esempio n. 1
0
 public void Return(T obj)
 {
     if (!stack.TryPush(obj))
     {
         obj.Dispose();
         Interlocked.Decrement(ref allocatedObjects);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Dispose instance
 /// </summary>
 public void Dispose()
 {
     if (pool != null)
     {
         pool.TryPush(obj);
     }
     else
     {
         obj.Dispose();
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Dispose instance
 /// </summary>
 public void Dispose()
 {
     pool?.TryPush(obj);
 }