python multiprocessing read write lock

2.2k Views Asked by At

I have multiprocessing python code using multiprocessing.Lock. I would like to change it to have read-write lock instead of simple lock. I was looking for an implementation of it but the only multiple readers / single writer locks I have found in python are based on threading not multiprocessing interface.

My question is does anyone knows if there is a way to use read-write lock in python multiprocessing ?

1

There are 1 best solutions below

0
On

Multiprocessing-utils dones't work for me.

There is some third_part read_write_lock which is writed for multiThreading case, u have to make a bit change before it can be used in multiprocessing case.

Here is the code:https://github.com/unhappydog/multiprocessing_read_write_lock/blob/master/rwlock/rwlock.py