Darien Raymond 7 лет назад
Родитель
Сommit
956868ef78
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      transport/pipe/impl.go

+ 4 - 0
transport/pipe/impl.go

@@ -3,6 +3,7 @@ package pipe
 import (
 	"errors"
 	"io"
+	"runtime"
 	"sync"
 	"time"
 
@@ -125,6 +126,9 @@ func (p *pipe) WriteMultiBuffer(mb buf.MultiBuffer) error {
 		switch {
 		case err == nil:
 			p.readSignal.Signal()
+
+			// Yield current goroutine. Hopefully the reading counterpart can pick up the payload.
+			runtime.Gosched()
 			return nil
 		case err == errBufferFull && p.discardOverflow:
 			mb.Release()