Skip to content

Commit decfc52

Browse files
committed
adding DequeueOrWaitForNextElementContext to Queue interface
1 parent c043815 commit decfc52

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

queue.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package goconcurrentqueue
22

3+
import "context"
4+
35
// Queue interface with basic && common queue functions
46
type Queue interface {
57
// Enqueue element
@@ -9,6 +11,10 @@ type Queue interface {
911
// DequeueOrWaitForNextElement dequeues an element (if exist) or waits until the next element gets enqueued and returns it.
1012
// Multiple calls to DequeueOrWaitForNextElement() would enqueue multiple "listeners" for future enqueued elements.
1113
DequeueOrWaitForNextElement() (interface{}, error)
14+
// DequeueOrWaitForNextElementContext dequeues an element (if exist) or waits until the next element gets enqueued and returns it.
15+
// Multiple calls to DequeueOrWaitForNextElementContext() would enqueue multiple "listeners" for future enqueued elements.
16+
// When the passed context expires this function exits and returns the context' error
17+
DequeueOrWaitForNextElementContext(context.Context) (interface{}, error)
1218
// Get number of enqueued elements
1319
GetLen() int
1420
// Get queue's capacity

0 commit comments

Comments
 (0)