immutable(ubyte)[] to receive
Alexey
makovey090601 at gmail.com
Thu Jan 20 09:38:55 UTC 2022
Maybe someone knows why it doesn't work?
```
import std.concurrency;
import std.stdio: write, writeln, writef, writefln;
import std.variant : Variant;
import std.process : thisThreadID;
alias Buffer = immutable(ubyte)[];
void pros2(string name)
{
receive(
(immutable(Buffer[]) h){
writeln(h);
ownerTid.send(123);
}
);
}
void main()
{
Buffer[] t ;
t ~= cast(Buffer)"sdfsdfsdf";
t ~= cast(Buffer)"sdfsdfsdf";
immutable(Buffer[]) ti = cast(immutable)t;
auto tid2 = spawn(&pros2, "hello");
send(tid2, ti);
receive(
(int h){writeln(h);}
);
}
```
More information about the Digitalmars-d
mailing list