Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module main;
- import std.stdio;
- import std.concurrency;
- shared struct S(T, uint M)
- {
- T[M] x;
- }
- shared struct M
- {
- int x;
- }
- private void runner(T)()
- {
- shared(T)* s = receiveOnly!(shared(T)*)();
- writeln(s.x.length);
- writeln(s.x[0]);
- send(ownerTid, true);
- }
- int main(string[] argv)
- {
- alias S!(M, 2) TS;
- alias shared(TS)* PS;
- Tid runnerTid = spawn(&runner!(TS));
- PS s = new TS;
- s.x[0] = M(42);
- send(runnerTid, s);
- bool ok = receiveOnly!bool();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement