by PaulHoule ยท 3y ago ยท 0 comments
I know they have answers for objects like ๐๐๐๐ and ๐๐๐๐, but What is the equivalent of the Java ๐๐ข๐๐๐๐๐๐๐๐ฃ๐๐ keyword? Are you supposed to use primitives like ๐ป๐๐๐ from
https://docs.python.org/3/library/threading.html
It seems to me one could make a @๐๐ข๐๐๐๐๐๐๐๐ฃ๐๐ annotation that would do nothing in a GIL Python but use a lock in a GIL-free Python.
The closest equivalent would be using a lock, semaphore or barrier object with a context manager .i.e. the with keyword.
Making the locking and unlocking of data automatically managed for you.
I generally try to stick to a deque in Python if I am doing anything concurrent.