public WaitList(params Task[] tasks) { if (tasks == null) { throw new ArgumentNullException("tasks"); } _storage = new Ring(); foreach (Task task in tasks) { if (task == null) { throw new ArgumentNullException("task"); } StorageAsRing.InsertTail(task); } }
public void Add(Task task) { if (task == null) { throw new ArgumentNullException(); } lock (this) { if (_storage == null) { _storage = task; } else if (!_isStorageRing) { _storage = new Ring(_storage, task); _isStorageRing = true; } else { StorageAsRing.InsertTail(task); } } }