How would you make this Python Dictionary thread-safe?

前端 未结 5 768
无人及你
无人及你 2021-01-02 10:50

I have a Web Server running in Python. The server is private, so i only expect around 20 users to connect to it. The server is multi-threaded (8 cores at the mo

5条回答
  •  悲&欢浪女
    2021-01-02 11:46

    You don´t need to lock dictionary to this operation, because this operation is atomic, and GIL take care this for you. Unless you have operations like read-change-write, don't worry.

提交回复
热议问题