MCPcopy
hub / github.com/jackc/pgx / bgRead

Method bgRead

pgconn/internal/bgreader/bgreader.go:71–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69}
70
71func (r *BGReader) bgRead() {
72 keepReading := true
73 for keepReading {
74 buf := iobufpool.Get(8192)
75 n, err := r.r.Read(*buf)
76 *buf = (*buf)[:n]
77
78 r.cond.L.Lock()
79 r.readResults = append(r.readResults, readResult{buf: buf, err: err})
80 if r.status == StatusStopping || err != nil {
81 r.status = StatusStopped
82 keepReading = false
83 }
84 r.cond.L.Unlock()
85 r.cond.Broadcast()
86 }
87}
88
89// Read implements the io.Reader interface.
90func (r *BGReader) Read(p []byte) (int, error) {

Callers 1

StartMethod · 0.95

Calls 2

GetFunction · 0.92
ReadMethod · 0.45

Tested by

no test coverage detected