ArrayPool()
 {
     // see: GetQueueIndex
     buckets = new MinimumQueue <T[]> [18];
     for (int i = 0; i < buckets.Length; i++)
     {
         buckets[i] = new MinimumQueue <T[]>(4);
     }
 }
示例#2
0
 private ArrayPool()
 {
     // see: GetQueueIndex
     buckets = new MinimumQueue <T[]> [18];
     locks   = new SpinLock[18];
     for (var i = 0; i < buckets.Length; i++)
     {
         buckets[i] = new MinimumQueue <T[]>(4);
         locks[i]   = new SpinLock(false);
     }
 }
		public void UnsafeOnCompleted(Action action) {
			if (continuation == null) {
				continuation = action;
				return;
			} else {
				if (continuation is Action act) {
					var q = new MinimumQueue<Action>(4);
					q.Enqueue(act);
					q.Enqueue(action);
					continuation = q;
					return;
				} else {
					((MinimumQueue<Action>)continuation).Enqueue(action);
				}
			}
		}