joncrlsn/dque

Blocking Dequeue & Peek functions

Kriechi opened this issue · 1 comments

The existing Dequeue() and Peek() functions simply return an ErrEmpty error if no items are in the queue.

I found myself trying to replace a go channel with dque, but was missing a proper blocking Dequeue function that only returns once at least one item is available.

Any thoughts on accepting such a feature request / PR?

I was wanting to implement that, but never got to it. That would be great if you submit a PR for a blocking Dequeue(). Suggest a name you think works best with common nomenclature for queues, maybe DequeueWait() or DequeueBlock()? Just throwing those out there. Go channels do not have a peek option, so maybe peek doesn't need a blocking option? But if you have a use-case for a blocking peek then I'd be OK with adding it too. I try to avoid implementing things without a real-life use-case.