func NewBuffer(frame trace.Frame, m int) *Buffer {
	b := &Buffer{
		wch: make(chan struct{}, m+1), // +1 for the final EOF, so it does not block
		// The capacity of rch is chosen so that writers to rch will never block.
		rch: make(chan struct{}, 4*m+2),
	}
	frame.Bind(b)
	b.Frame = frame
	for i := 0; i < m; i++ {
		b.wch <- struct{}{}
	}
	return b
}
// NewBuffer creates a new buffer with limit m.
NewBuffer creates a new buffer with limit m.
// NewBuffer creates a new buffer with limit m .
func NewBuffer(frame trace.Frame, m int) *Buffer {
	b := &Buffer{
		wch: make(chan struct{}, m+1), 
		rch: make(chan struct{}, 4*m+2),
	}
	frame.Bind(b)
	b.Frame = frame
	for i := 0; i < m; i++ {
		b.wch <- struct{}{}
	}
	return b
}
func NewBuffer ( frame trace . Frame , m int ) * Buffer { b := & Buffer { wch : make ( chan struct { } , m + 1 ) , rch : make ( chan struct { } , 4 * m + 2 ) , } frame . Bind ( b ) b . Frame = frame for i := 0 ; i < m ; i ++ { b . wch <- struct { } { } } return b }
NewBuffer creates a new buffer with limit m.
NewBuffer creates a new buffer with limit m .
// +1 for the final EOF, so it does not block // The capacity of rch is chosen so that writers to rch will never block.