Skip to content

Instantly share code, notes, and snippets.

@gnodet
Last active November 14, 2025 20:57
Show Gist options
  • Select an option

  • Save gnodet/f93643630f296c5db37faed20b83fe85 to your computer and use it in GitHub Desktop.

Select an option

Save gnodet/f93643630f296c5db37faed20b83fe85 to your computer and use it in GitHub Desktop.
max = current() + 100s
while (max - current() > 0)
lock.tryLock(shared, max - current())
if not present locally
lock.unlock(shared)
if lock.tryLock(exclusive, 1s)
if not present locally
download
lock.unlock(exclusive)
break
else
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment