door_linux.go 289 B

12345678910111213141516171819
  1. package door
  2. import (
  3. "time"
  4. )
  5. func (d *Door) setupChannels() {
  6. if d.ReaderCanClose {
  7. // Yes, expect Reader and Writer to stop
  8. d.wg.Add(2)
  9. } else {
  10. // Default: Only wait for the Writer to stop
  11. d.wg.Add(1)
  12. }
  13. go Reader(d)
  14. time.Sleep(time.Millisecond)
  15. go Writer(d)
  16. }