ReadLock guarantees only the maximum number of goroutines can read at a time.
(reader int)
| 217 | |
| 218 | // ReadLock guarantees only the maximum number of goroutines can read at a time. |
| 219 | func (rw *readerWriter) ReadLock(reader int) { |
| 220 | // If a write is occurring, wait for it to complete. |
| 221 | rw.write.Wait() |
| 222 | |
| 223 | // Acquire a buffer from the semaphore channel. |
| 224 | rw.readerControl.Acquire(1) |
| 225 | } |
| 226 | |
| 227 | // ReadUnlock gives other goroutines waiting to read their opporunity. |
| 228 | func (rw *readerWriter) ReadUnlock(reader int) { |