writer is a goroutine that listens on the shutdown channel and performs writes until the channel is signaled.
()
| 182 | // writer is a goroutine that listens on the shutdown channel and |
| 183 | // performs writes until the channel is signaled. |
| 184 | func (rw *readerWriter) writer() { |
| 185 | // Schedule the call to Done for once the method returns. |
| 186 | defer rw.reportShutdown.Done() |
| 187 | |
| 188 | for { |
| 189 | select { |
| 190 | case <-rw.shutdown: |
| 191 | log.Printf("%s\t: #> Writer Shutdown", rw.name) |
| 192 | return |
| 193 | default: |
| 194 | rw.performWrite() |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | // performWrite performs the actual write work. |
| 200 | func (rw *readerWriter) performWrite() { |