std.concurrency.receive and shared const(char)[]?
BakedPineapple
bakedpineapple at airmail.cc
Sun Jun 28 16:11:50 UTC 2020
import std.stdio;
import std.concurrency;
void main()
{
auto t = spawn((){
receive((shared const(char)[] char_arr) {
ownerTid.send(true);
});
});
shared const(char)[] char_arr = "cut my code into pieces";
t.send(char_arr);
assert(receiveOnly!(bool) == true);
}
When I run this program, it blocks on the receive() inside the
spawned thread. What am I doing wrong?
More information about the Digitalmars-d-learn
mailing list