-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doesn't seem super useful, as the GIL means a cache lock might not get to contend that much. However it might find utility with the free threaded interpreter eventually. Anyway it's not huge and it's not very complex, although the contextvars API is not great for lazy initialisation. Still even though the initialisation looks like it could lead to redundant inits (similar to the clearing cache which can get multi-cleared) it should be safe: different threads hitting `cache` concurrently will each hit their own lookup failure, and initialise their local cache, and set their personal contextvar. For a var to get double-init would require the same thread to be concurrent with itself, which is not possible. Fixes #180
- Loading branch information
Showing
2 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters