vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Struct Channel

Thread-safe typed data channel implementation.

struct Channel(T, ulong buffer_size = 100) ;

The implementation supports multiple-reader-multiple-writer operation across multiple tasks in multiple threads.

Fields

NameTypeDescription
m_impl shared(ChannelImpl!(T,buffer_size))

Properties

NameTypeDescription
bufferFill[get] size_tReturns the current count of items in the buffer.
empty[get] boolDetermines whether there is more data to read in a single-reader scenario.

Methods

NameDescription
close () Closes the channel.
consumeAll (dst) Attempts to consume all elements currently in the queue.
consumeOne () Consumes a single element off the queue.
put (item) Enqueues an element.
tryConsumeOne (dst) Attempts to consume a single element.
Authors

Sönke Ludwig

Copyright

© 2017-2019 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.