class MutexLock(AbstractFileLock): """:class:`MutexLock` is a thread-based rw lock based on :class:`dogpile.core.ReadWriteMutex`.""" def __init__(self, filename): """Constructor. :param filename: """ self.mutex = ReadWriteMutex() def acquire_read_lock(self, wait): """Default acquire_read_lock.""" ret = self.mutex.acquire_read_lock(wait) return wait or ret def acquire_write_lock(self, wait): """Default acquire_write_lock.""" ret = self.mutex.acquire_write_lock(wait) return wait or ret def release_read_lock(self): """Default release_read_lock.""" return self.mutex.release_read_lock() def release_write_lock(self): """Default release_write_lock.""" return self.mutex.release_write_lock()
class MutexLock(AbstractFileLock): def __init__(self, filename): self.mutex = ReadWriteMutex() def acquire_read_lock(self, wait): ret = self.mutex.acquire_read_lock(wait) return wait or ret def acquire_write_lock(self, wait): ret = self.mutex.acquire_write_lock(wait) return wait or ret def release_read_lock(self): return self.mutex.release_read_lock() def release_write_lock(self): return self.mutex.release_write_lock()
def __init__(self, filename): """Constructor. :param filename: """ self.mutex = ReadWriteMutex()
def __init__(self, filename): self.mutex = ReadWriteMutex()