private async Task BeginGroupCommitLoopAsync() { bool gotLock = false; try { if (!(gotLock = commitLock.TryGetLock())) { return; } while (await this.GroupCommit()) { // force yield thread await Task.Delay(TimeSpan.FromTicks(1)); } } finally { if (gotLock) { commitLock.ReleaseLock(); } } }
private async Task BeginDependencyCompletionLoopAsync() { bool gotLock = false; try { if (!(gotLock = dependencyLock.TryGetLock())) { return; } while (this.CheckDependenciesCompleted()) { // force yield thread await Task.Delay(TimeSpan.FromTicks(1)); } } finally { if (gotLock) { dependencyLock.ReleaseLock(); } } }
private async Task BeginCheckpointLoopAsync() { bool gotLock = false; try { if (!(gotLock = checkpointLock.TryGetLock())) { return; } while (await this.Checkpoint(resources, transactions)) { } } finally { if (gotLock) { checkpointLock.ReleaseLock(); } } }