MCPcopy
hub / github.com/rs/zerolog / poll

Method poll

diode/diode.go:93–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91}
92
93func (dw Writer) poll() {
94 defer close(dw.done)
95 for {
96 d := dw.d.Next()
97 if d == nil {
98 return
99 }
100 p := *(*[]byte)(d)
101 dw.w.Write(p)
102
103 // Proper usage of a sync.Pool requires each entry to have approximately
104 // the same memory cost. To obtain this property when the stored type
105 // contains a variably-sized buffer, we add a hard limit on the maximum buffer
106 // to place back in the pool.
107 //
108 // See https://golang.org/issue/23199
109 const maxSize = 1 << 16 // 64KiB
110 if cap(p) <= maxSize {
111 bufPool.Put(p[:0])
112 }
113 }
114}

Callers 1

NewWriterFunction · 0.95

Calls 2

NextMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected