Who Ate My Cheese

I saw this code no long ago lock = threading.Lock() # some code if some_condition: with lock: if some_condition: # some code The same condition checked twice before and after the lock aquired and released. It took me a while to think through this, and you’ll probably see something simular if you do coding with threads. Let me explain why is it. Imagine in a world, there are only Tom and Jerry...

May 29, 2021