-
Notifications
You must be signed in to change notification settings - Fork 159
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
cachedmethod not working as expected with locks #279
Comments
7677e50 looks to fix the issues I'm facing above but causing a small performance impact |
@npezolano: the title of this issue "not working as expected with locks" is something that I would have to admit is probably true, sorry. |
On a final note: Yes, it's an issue, probably an issue that should be at least stated in the docs. |
I'm sure removing thread safety everywhere in the documentation will fix the issue @tkem |
The below example runs, however it seems like it's not working as expected. In the below example
calc
will get called multiple times for the same n when it should be locked by a thread and then cached, I tried using bothLock
andRLock
and get the same result. The cache does seem to be working if I rerunres = obj.multithreaded_run()
below everything will be cached, the problem looks to be if the function to be cached takes up to a few seconds to run and its required by multiple threads it won't lock properly. The problem gets worse if you use more threads. This is a follow up on the previous suggestion in #274See screenshot for example: each n should only print once:
The text was updated successfully, but these errors were encountered: