Queue

A queue, useful for coordinating producer and consumer coroutines.

If $(D_PSYMBOL maxSize) is equal to zero, the queue size is infinite. Otherwise $(D_PSYMBOL put()) will block when the queue reaches maxsize, until an item is removed by $(D_PSYMBOL get()).

You can reliably know this $(D_PSYMBOL Queue)'s size with $(D_PSYMBOL qsize()), since your single-threaded asynchronous application won't be interrupted between calling $(D_PSYMBOL qsize()) and doing an operation on the Queue.

This class is not thread safe.

Constructors

this
this(EventLoop eventLoop)
Undocumented in source.

Members

Functions

get
T get()

Remove and return an item from the queue.

getNowait
T getNowait()

Remove and return an item from the queue.

get_
T get_()
Undocumented in source. Be warned that the author may not have intended to support it.
join
void join()

Block until all items in the queue have been gotten and processed.

put
void put(T item)

Put an item into the queue.

putNowait
void putNowait(T item)

Put an item into the queue without blocking.

put_
void put_(T item)
Undocumented in source. Be warned that the author may not have intended to support it.
taskDone
void taskDone()

Indicate that a formerly enqueued task is complete.

toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

empty
bool empty [@property getter]

Return $(D_KEYWORD true) if the queue is empty, $(D_KEYWORD false) otherwise.

full
bool full [@property getter]

Return $(D_KEYWORD true) if there are maxsize items in the queue.

maxsize
size_t maxsize [@property getter]

Number of items allowed in the queue.

qsize
size_t qsize [@property getter]

Number of items in the queue.

Meta