WriteLock blocks all reading so the write can happen safely.
()
| 232 | |
| 233 | // WriteLock blocks all reading so the write can happen safely. |
| 234 | func (rw *readerWriter) WriteLock() { |
| 235 | // Add 1 to the waitGroup so reads will block |
| 236 | rw.write.Add(1) |
| 237 | |
| 238 | // Acquire all the buffers from the semaphore channel. |
| 239 | rw.readerControl.Acquire(rw.maxReads) |
| 240 | } |
| 241 | |
| 242 | // WriteUnlock releases the write lock and allows reads to occur. |
| 243 | func (rw *readerWriter) WriteUnlock() { |
no test coverage detected