Skip to content

Instantly share code, notes, and snippets.

@behnammohammadi
Last active May 2, 2023 18:14
var cancellationToken = new CancellationTokenSource(TimeSpan.FromSeconds(30)).Token;
lock (_lock)
{
if (cancellationToken.IsCancellationRequested)
throw new TimeoutException();
// critical section - crawling
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment