oops, be a good citizen

Signed-off-by: Xe Iaso <me@christine.website>
This commit is contained in:
Cadey Ratio 2022-04-24 16:29:53 +00:00
parent aa58cbb9df
commit bbeaa584c0
1 changed files with 2 additions and 0 deletions

View File

@ -22,6 +22,8 @@ func (q Queue[T]) Pop() T {
return <-q.data
}
// TryPop tries to pop from a queue. If it stalls long enough for the context
// to time out, it panics.
func (q Queue[T]) TryPop(ctx context.Context) T {
select {
case val := <-q.data: