diff --git a/README.md b/README.md index f91a9e9..4d26ea9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# priorityq - generic priority queue in Go +# priorityq - generic prioritized message queue in Go This module was inspired by [a reddit post][reddit] wherein /u/zandery23 asked how to implement a priority queue in Go. A fantastic solution was [provided by @@ -6,7 +6,7 @@ how to implement a priority queue in Go. A fantastic solution was [provided by not completely precise. Particularly, the second select block does not guarantee that an item from the -priority queue will be taken if there is also an item in the regular queue. +prioritized queue will be taken if there is also an item in the regular queue. ```go select { @@ -26,10 +26,10 @@ From the [Go Language Specification][go_select]: Thus, it is possible for the second case to be chosen even if the first case is also ready. -The `precise` package in this module implements a concurrent priority queue that -guarantees receipt of a high-priority items before low-priority ones. This is -primarily a fun exercise, I cannot recommend that anyone actually use this in a -real project. +The `precise` package in this module implements a concurrent, prioritized +message queue that guarantees receipt of a high-priority items before +low-priority ones. This is primarily a fun exercise, I cannot recommend that +anyone actually use this in a real project. [reddit]: https://www.reddit.com/r/golang/comments/11drc17/worker_pool_reading_from_two_channels_one_chan/ [sol]: https://www.reddit.com/r/golang/comments/11drc17/worker_pool_reading_from_two_channels_one_chan/jabfvkh/ diff --git a/precise/lib.go b/precise/lib.go index 82fa01d..9065024 100644 --- a/precise/lib.go +++ b/precise/lib.go @@ -6,7 +6,7 @@ import ( "gogs.humancabbage.net/sam/priorityq/circ" ) -// Q is a precise, concurrent priority queue. +// Q is a precise, concurrent, prioritized message queue. // // Each queue has two internal buffers, high and low. This implementation // guarantees that when there are items in both buffers, consumers receive @@ -18,7 +18,7 @@ type Q[T any] struct { *state[T] } -// Make a new priority queue. +// Make a new queue. func Make[T any](cap int) Q[T] { high := circ.Make[T](cap) low := circ.Make[T](cap)