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

Method reader

chapter7/patterns/semaphore/semaphore.go:146–160  ·  view source on GitHub ↗

reader is a goroutine that listens on the shutdown channel and performs reads until the channel is signaled.

(reader int)

Source from the content-addressed store, hash-verified

144// reader is a goroutine that listens on the shutdown channel and
145// performs reads until the channel is signaled.
146func (rw *readerWriter) reader(reader int) {
147 // Schedule the call to Done for once the method returns.
148 defer rw.reportShutdown.Done()
149
150 for {
151 select {
152 case <-rw.shutdown:
153 log.Printf("%s\t: #> Reader Shutdown", rw.name)
154 return
155
156 default:
157 rw.performRead(reader)
158 }
159 }
160}
161
162// performRead performs the actual reading work.
163func (rw *readerWriter) performRead(reader int) {

Callers 1

startFunction · 0.95

Calls 1

performReadMethod · 0.95

Tested by

no test coverage detected