WriteLock acquires the exclusive write side of a readers–writer mutex. It locks globalLock, so a writer blocks until every active reader has called ReadUnlock. section 4.2.2
The function contains one operation: rw.globalLock.Lock(). Readers share access, but the first reader locks globalLock and the last reader releases it, making writers wait during the entire read phase.
Acquiring the write side
func (rw *ReadWriteMutex) WriteLock() { rw.globalLock.Lock() } // exclusive update rw.WriteLock() // modify shared state rw.WriteUnlock()
