MCPcopy Create free account
hub / github.com/goinaction/code / ReadUnlock

Method ReadUnlock

chapter7/patterns/semaphore/semaphore.go:228–231  ·  view source on GitHub ↗

ReadUnlock gives other goroutines waiting to read their opporunity.

(reader int)

Source from the content-addressed store, hash-verified

226
227// ReadUnlock gives other goroutines waiting to read their opporunity.
228func (rw *readerWriter) ReadUnlock(reader int) {
229 // Release the buffer back into the semaphore channel.
230 rw.readerControl.Release(1)
231}
232
233// WriteLock blocks all reading so the write can happen safely.
234func (rw *readerWriter) WriteLock() {

Callers 1

performReadMethod · 0.95

Calls 1

ReleaseMethod · 0.45

Tested by

no test coverage detected