read-write-lock
- a write lock prevents all other writes or reads
- a read lock only prevents writes
Based on mutexify!
Algorithm
Write lock requests get put on the queue and handed out in order.
Read lock requests get put on the queue too - but when one read lock is given, all read requests in the queue go at once - once they all come back, it's on to the next lock request in the queue.
Usage
var createMutex = var mutex = mutex mutex mutex