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

Method Start

pgconn/internal/bgreader/bgreader.go:33–46  ·  view source on GitHub ↗

Start starts the backgrounder reader. If the background reader is already running this is a no-op. The background reader will stop automatically when the underlying reader returns an error.

()

Source from the content-addressed store, hash-verified

31// Start starts the backgrounder reader. If the background reader is already running this is a no-op. The background
32// reader will stop automatically when the underlying reader returns an error.
33func (r *BGReader) Start() {
34 r.cond.L.Lock()
35 defer r.cond.L.Unlock()
36
37 switch r.status {
38 case StatusStopped:
39 r.status = StatusRunning
40 go r.bgRead()
41 case StatusRunning:
42 // no-op
43 case StatusStopping:
44 r.status = StatusRunning
45 }
46}
47
48// Stop tells the background reader to stop after the in progress Read returns. It is safe to call Stop when the
49// background reader is not running.

Callers 6

connectOneFunction · 0.80
ConstructFunction · 0.80
TestBGReaderStressFunction · 0.80

Calls 1

bgReadMethod · 0.95

Tested by 4

TestBGReaderStressFunction · 0.64