Skip to content

kunallillaney/blaze-lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blaze-lock

Hex.pm

blaze-lock is a python module which implements areaders-writer lock using Redis.

Installation

pip install blazelock

Implementation

acquire_read_lock:
  mutex_lock_acquire and not writer_waiting
  reader_count ++
  mutex_lock_release

release_read_lock:
  mutex_lock_acquire
  reader_count --
  if reader_count == 0:
    notify_all
  mutex_lock_release

acquire_writer_lock:
  mutex_lock_acquire
  while reader_count > 0:
    writer_waiting = true
    wait

release_writer_lock:
  writer_waiting = false
  mutex_lock_release

wait:
  mutex_lock_release
  wake_signal
  mutex_lock_acquire

About

A readers-writer lock using Redis

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages