Is there any threadsafe queue?

Seb via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 13 22:54:06 UTC 2017


On Wednesday, 13 September 2017 at 07:51:19 UTC, John Burton 
wrote:
> Is there any threadsafe queue in the standard library?
> I've not been able to find anything but thought I'd check 
> before making my own.
>
> I want to be able to assemble messages (Which are just streams 
> of bytes) in one thread into a struct and push them to the 
> queue, and then have a another thread be able to read and 
> process the messages. Single producer and consumer.

Not sure what you are looking for, but a really cool topic are 
lock-free data structures. They are inherently thread-safe. One 
popular lib in D:

https://code.dlang.org/packages/lock-free


More information about the Digitalmars-d-learn mailing list