-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
26 lines (26 loc) · 1.15 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Package chanqueue implements a queue that uses channels for input and output
// to provide concurrent access to a re-sizable queue. This allows the queue to
// be used like a channel. Closing the input channel closes the output channel
// when all queued items are read, consistent with channel behavior. In other
// words chanqueue is a dynamically buffered channel with up to infinite
// capacity.
//
// ChanQueue also supports circular buffer behavior when created using
// `NewRing`. When the buffer is full, writing an additional item discards the
// oldest buffered item.
//
// When using an unlimited buffer capacity, the default, use caution as the
// buffer is still limited by the resources available on the host system.
//
// # Caution
//
// The behavior of chanqueue differs from the behavior of a normal channel in
// one important way: After writing to the In() channel, the data may not be
// immediately available on the Out() channel (until the buffer goroutine is
// scheduled), and may be missed by a non-blocking select.
//
// # Credits
//
// This implementation is based on ideas/examples from:
// https://github.com/eapache/channels
package chanqueue