public ReadStatus Get(ref Lsn lsn, ref DbEntry data, GetMode mode) { DbRetVal ret; lock (rscLock) { DB_LOGC *logcp = CheckDisposed(); fixed(byte *dataBufP = data.Buffer) { data.dbt.data = dataBufP + data.Start; ret = LogcGet(logcp, ref lsn.lsn, ref data.dbt, unchecked ((UInt32)mode)); } } switch (ret) { case DbRetVal.NOTFOUND: break; case DbRetVal.BUFFER_SMALL: break; default: Util.CheckRetVal(ret); break; } data.SetReturnType(DbType.Unknown, 0); return((ReadStatus)ret); }
protected DB_LOGC *CheckDisposed() { // avoid multiple volatile memory access DB_LOGC *logcp = this.logcp; if (logcp == null) { throw new ObjectDisposedException(disposedStr); } return(logcp); }
// should be run in a CER, under a lock on rscLock, and not throw exceptions DbRetVal ReleaseUnmanagedResources() { DB_LOGC *logcp = this.logcp; if (logcp == null) { return(DbRetVal.SUCCESS); } // DB_LOGC->Close() could be a lengthy call, so we call Disposed() first, and the // CER ensures that we reach DB_LOGC->Close() without external interruption. // This is OK because one must not use the handle after DB_LOGC->Close() was called, // regardless of the return value. Disposed(); DbRetVal ret = logcp->Close(logcp, 0); return(ret); }
// assumes that logcp != null! internal void Initialize(DB_LOGC* logcp) { this.logcp = logcp; LogcGet = logcp->Get; }
// does not check for logcp == null! void Disposed() { logcp = null; env.RemoveLogCursor(this); }
// assumes that logcp != null! internal void Initialize(DB_LOGC *logcp) { this.logcp = logcp; LogcGet = logcp->Get; }