reader is a goroutine that listens on the shutdown channel and performs reads until the channel is signaled.
(reader int)
| 144 | // reader is a goroutine that listens on the shutdown channel and |
| 145 | // performs reads until the channel is signaled. |
| 146 | func (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. |
| 163 | func (rw *readerWriter) performRead(reader int) { |