Consider this MWE: When this script is executed, it instantiates the_setup and serves it. Then I want clients to be able to do things like this from other scripts: However, I get RuntimeError: RLock objects should only be shared between processes through inheritance. If the with the_setup.hold_hardware(): is removed, it works fine but then I cannot guarantee that the hardware
Tag: locking
How to read a variable without lock in Python threads?
I am using Python threading to do some jobs at the same time. I leave the main thread to perform task_A, and create one thread to perform task_B at the same time. Below is the simplified version of the code I am working on: I know the above code doesn’t do something meaningful. Please think of it as a simplified
When spawn processes, Does Lock have different id?
I’m trying to figure out how Lock works under the hood. I run this code on MacOS which using “spawn” as default method to start new process. from multiprocessing import Process, Lock, …