-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement special handling for ring of size one
- Loading branch information
Showing
4 changed files
with
127 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
/* | ||
Package channelqueue implements a queue that uses channels for input and output | ||
to provide concurrent access to a resizable queue, and allowing 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 | ||
channelqueue is a dynamically buffered channel with up to infinite capacity. | ||
When specifying an unlimited buffer capacity use caution as the buffer is still | ||
limited by the resources available on the host system. | ||
Caution | ||
The behavior of channelqueue 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 channelqueue 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 channelqueue is a dynamically buffered | ||
// channel with up to infinite capacity. | ||
// | ||
// ChannelQueue also supports circular buffer behavior when created using | ||
// `NewRing`. When the buffer is full, writing an additional item discards the | ||
// oldest buffered item. | ||
// | ||
// When specifying an unlimited buffer capacity use caution as the buffer is | ||
// still limited by the resources available on the host system. | ||
// | ||
// # Caution | ||
// | ||
// The behavior of channelqueue 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 channelqueue |