A lock answers one question: who may touch this data? Threads also need to answer others. Can I go in again, when I already hold the lock? May only three of us use this resource at once? Has the other thread finished its set-up? Is there something for me to do yet? Is everyone here? Python’s threading module has a tool for each question. This lesson gives each a small, deterministic example.
More lessons in Complete Python Programming