In Java, you can make a variable thread safe by just adding the synchronized
keyword. Is there anything that can achieve the same results in Python?
You can use with self.lock:
and then put your code inside there. See http://theorangeduck.com/page/synchronized-python for more information.