-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Require explicit name for BoundedSemaphore()? #87
Comments
You are largely correct but you've glossed over a small detail, the directory is randomized by the portalocker/portalocker/utils.py Lines 430 to 449 in ea5e180
In practice you will never have 2 unrelated applications colliding :) |
|
Oops... in that case I have made a wrong assumption a long time ago and created a semaphore that could cause issues in some cases. I'm in the process of creating a new release anyhow so I'll make sure to add your suggested |
No worries. Happens to the best of us 😄 |
As a backstory, I'm guessing this made me think it was random. On my laptop I get this:
Seemed pretty random to me ;) |
Hmm… Is that inside some kind of container or WSL on Windows or something? |
No... that's on OS X |
OK, so that seems to be a per-user $TMPDIR. I think my original observation mostly still holds: Two unrelated applications running as the same user on the same host could interfere with each other. |
Your observation is correct indeed. If I start 2 completely unrelated applications I get the same results. Furthermore:
I really should have read the Python manual, it's pretty clear about this :X |
Say there are two unrelated applications on the same host, and they both use the default
name
forBoundedSemaphore()
.For example:
Won't they both try and use the same set of lock files and interfere with each other?
To ensure backwards compatibility, you could create a new class
NamedBoundedSemaphore
with a required name argument and deprecateBoundedSemaphore
The text was updated successfully, but these errors were encountered: