2023-03-02 09:53:12 +00:00
|
|
|
// Package priorityq provides generic implementations of various concurrent,
|
|
|
|
// prioritized queues.
|
|
|
|
//
|
|
|
|
// # Behavior
|
|
|
|
//
|
|
|
|
// All types of queues in this module act similarly to buffered Go channels.
|
2023-03-02 03:22:37 +00:00
|
|
|
//
|
2023-03-02 09:53:12 +00:00
|
|
|
// - They are bounded to a fixed capacity, set at construction.
|
|
|
|
// - Closing and sending to an already-closed queue causes a panic.
|
|
|
|
// - Receivers can continue getting items after closure, and can use a final
|
|
|
|
// bool to determine when there are none remaining.
|
|
|
|
// - They are safe for multiple concurrent senders and receivers.
|
2023-03-02 03:22:37 +00:00
|
|
|
//
|
2023-03-02 09:53:12 +00:00
|
|
|
// # Implementation
|
2023-03-02 03:22:37 +00:00
|
|
|
//
|
2023-03-02 09:53:12 +00:00
|
|
|
// All data structures in this module use [generics], introduced in Go 1.18.
|
2023-03-02 03:22:37 +00:00
|
|
|
//
|
2023-03-02 09:53:12 +00:00
|
|
|
// All of the concurrent data structures in this package use a [sync.Mutex]
|
|
|
|
// and a few [sync.Cond] variables.
|
|
|
|
//
|
|
|
|
// [generics]: https://go.dev/blog/intro-generics
|
|
|
|
package priorityq
|