Python : Any way to get one process to have a write lock and others to just read on parallel?

前端 未结 5 1354
野的像风
野的像风 2020-12-01 09:36

Let\'s say I have a dictionary that contains key-values where the value is an object with a lock. Each process needs to get the lock to modify the specific object, but the k

5条回答
  •  借酒劲吻你
    2020-12-01 10:05

    For the reference: pygolang provides sync.RWMutex (2, 3), which is reader-writer mutex with priority for writers.

    The dictionary has to be updated under corresponding rwmutex write-locked, while read access to the dictionary has to be done under read-lock.

提交回复
热议问题