public static BaseCursorAsync <TK, TV, TCursor> Create(BaseSeries <TK, TV> source, Func <TCursor> cursorFactory) { BaseCursorAsync <TK, TV, TCursor> inst; return(new BaseCursorAsync <TK, TV, TCursor>(source, cursorFactory)); // TODO #84 //if (!Pool.TryTake(out inst)) { // inst = new BaseCursorAsync<TK, TV, TCursor>(source, cursorFactory); //} //inst._source = source; //inst._innerCursor = cursorFactory(); //inst._disposed = false; //return inst; }
private void Dispose(bool disposing) { if (!disposing) { return; } _source = null; _innerCursor?.Dispose(); _innerCursor = default(TCursor); _unusedTcs = null; _cancelledTcs = null; _registration.Dispose(); _registration = default(CancellationTokenRegistration); _token = default(CancellationToken); // TODO #84 //Pool.TryAdd(this); }
// NB factory could be more specific than GetCursor method of the source, which returns an interface // At the same time, we need access to BaseSeries members and cannot use Source property of the cursor public BaseCursorAsync(BaseSeries <TK, TV> source, Func <TCursor> cursorFactory) { this._source = source; _innerCursor = cursorFactory(); }