Channel

Common Queue collections implementation.

Postblit

this(this)
this(this)

Prevent copy, only move.

Members

Aliases

Self
alias Self = typeof(this)
Undocumented in source.

Functions

move
Self move()

Moves queues to movable channel of same type.

move
void move(Self target)

Moves queues to another channel.

pair
Complement!Message pair(Args args)

Makes new registered Queue and returns Complement channel. Maximum count of messages in a buffer can be provided.

Static variables

__isIsolatedType
auto __isIsolatedType;

Allow transferring between tasks

Variables

queues
Array!(Queue!Message) queues;

All registered Queues.

Examples

Autofinalize and take all.

auto ii = Input!int();

{
    auto oo = ii.pair(5);

    oo.put(7);
    oo.put(77);
}

assert(ii[] == [7, 77]);

Movement.

import std.algorithm;

auto i1 = Input!int();
auto o1 = i1.pair(5);

auto i2 = i1.move;
auto o2 = o1.move;

o2.put(7);
o2.put(77);
o2.destroy();

assert(i1[] == []);
assert(i2[] == [7, 77]);

Round robin input

auto ii = Input!int();

auto o1 = ii.pair(5);
auto o2 = ii.pair(5);

o1.put(7);
o1.put(777);
o1.destroy();

o2.put(13);
o2.put(666);
o2.destroy();

assert(ii[] == [7, 13, 777, 666]);

Round robin output

auto oo = Output!int();

auto i1 = oo.pair(5);
auto i2 = oo.pair(5);

oo.put(7);
oo.put(13);
oo.put(777);
oo.put(666);
oo.destroy();

assert(i1[] == [7, 777]);
assert(i2[] == [13, 666]);

Meta