Is there some kind of Blocking Queue for D?

Jonathan M Davis newsgroup.d at jmdavisprog.com
Thu Jul 10 09:39:43 UTC 2025


On Thursday, July 10, 2025 3:22:30 AM Mountain Daylight Time Bienlein via Digitalmars-d-learn wrote:
> Hello,
>
> I'm looking for some kind of blocking queue for D, that is if the
> queue is empty the thread doing a take on the queue is blocked
> until an item has been added to the queue. Couldn't find anything
> in the standard library.

std.concurrency's send / prioritySend and receive / receiveOnly /
receiveTimeout can be used in such a fashion:

https://dlang.org/phobos/std_concurrency.html#.send
https://dlang.org/phobos/std_concurrency.html#.prioritySend
https://dlang.org/phobos/std_concurrency.html#.receive
https://dlang.org/phobos/std_concurrency.html#.receiveOnly
https://dlang.org/phobos/std_concurrency.html#.receiveTimeout

- Jonathan M Davis






More information about the Digitalmars-d-learn mailing list