12345678910111213141516171819 |
- package door
- import (
- "time"
- )
- func (d *Door) setupChannels() {
- if d.ReaderCanClose {
- // Yes, expect Reader and Writer to stop
- d.wg.Add(2)
- } else {
- // Default: Only wait for the Writer to stop
- d.wg.Add(1)
- }
- go Reader(d)
- time.Sleep(time.Millisecond)
- go Writer(d)
- }
|