Exemple #1
0
 private async Task ReturnIndex()
 {
     using (var l = await _mutex.Lock())
     {
         if (_pool != null)
         {
             _pool.ReturnIndex(Value);
             _pool = null;
         }
     }
 }
Exemple #2
0
            // private readonly AsyncMutex _mutex = new AsyncMutex();

            public PoolIndex(IndexPool pool, int index)
            {
                _pool = pool ?? throw new ArgumentNullException(nameof(pool));
                Value = index;
            }