(ctx context.Context, l Listener, le ListenerWithErr)
| 75 | } |
| 76 | |
| 77 | func NewMsgQueue(ctx context.Context, l Listener, le ListenerWithErr) *MsgQueue { |
| 78 | if l == nil && le == nil { |
| 79 | panic("l or le must be non-nil") |
| 80 | } |
| 81 | q := &MsgQueue{ |
| 82 | ctx: ctx, |
| 83 | cond: sync.NewCond(&sync.Mutex{}), |
| 84 | l: l, |
| 85 | le: le, |
| 86 | } |
| 87 | go q.run() |
| 88 | return q |
| 89 | } |
| 90 | |
| 91 | func (q *MsgQueue) run() { |
| 92 | for { |