-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea: support N lock holders #42
Comments
Sounds like a semaphore. |
yes, sure, it's semaphore inside, but would be nice have two lock realizatons with same interface. |
I would rather keep this library focused on its initial goal: a fast and robust lock for redis. I don't have anything against implementing a semaphore but it seems to me that it would be better implemented in another library. Plus it's confusing, why would lock library implement a semaphore? |
My little case: I need library, that can use Locks if holder=1 and use semaphore if holder=2-N: i don't like write code such as: if holder == 1:
with redis_lock.Lock(r, key):
do_cricical_section()
else:
with redis_lock.Semaphore(r, key, holder):
do_cricical_section() I prefer other approach: with redis_lock.CommonLock(r, key, holder): # inside if holders > 1 using semaphore, otherwise - simple lock
do_cricical_section() Your library is the best among its competitors, would be nice if inside her will be implemented other synchronization primitives. |
Such as Consul offers:
The text was updated successfully, but these errors were encountered: