This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
class ReadWriteLock(object): | |
""" An implementation of a read-write lock for Python. | |
Any number of readers can work simultaneously but they | |
are mutually exclusive with any writers (which can | |
only have one at a time). | |
This implementation is reader biased. This can be harmful | |
under heavy load because it can starve writers. | |
However under light load it will be quite perfomant since |