private unsafe C4Slice Execute(C4TryLogicDelegate4 block, int attemptCount) { if (attemptCount > _maxAttempts) { ThrowOrHandle(); } var err = default(C4Error); var retVal = block(&err); if (retVal.buf != null) { Exception = null; return(retVal); } Exception = new CBForestException(err); if (err.domain == C4ErrorDomain.ForestDB && err.code == (int)ForestDBStatus.HandleBusy) { Thread.Sleep(RETRY_TIME); return(Execute(block, attemptCount + 1)); } ThrowOrHandle(); return(retVal); }
private unsafe int Execute(C4TryLogicDelegate3 block, int attemptCount) { if (attemptCount > _maxAttempts) { ThrowOrHandle(); } var err = default(C4Error); var retVal = block(&err); if (retVal >= 0) { Exception = null; return retVal; } Exception = new CBForestException(err); if (err.domain == C4ErrorDomain.ForestDB && err.code == (int)ForestDBStatus.HandleBusy) { Thread.Sleep(RETRY_TIME); return Execute(block, attemptCount + 1); } ThrowOrHandle(); return retVal; }