TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Keyway: A simple lock library

10 pointsby adefaover 10 years ago

1 comment

zokierover 10 years ago
Maybe I&#x27;m missing something, but shouldn&#x27;t locks generally have some protections against race conditions? E.g. starting from line 15:<p><pre><code> acquire_lock_for() { if not_locked $1; then lock_log &quot;Creating $1 lock.&quot; touch &quot;$LOCK_DIR&#x2F;$1&quot;.lock check_execution &quot;acquire lock&quot; fi } </code></pre> what if another process creates lock file between the `if not_locked` and `touch` lines?
评论 #8832912 未加载
评论 #8832667 未加载