View mode: basic / threaded / horizontal-split · Log in · Help
December 07, 2012
concurrency send() error
I was messing about with std.concurrency and ran in to this: 
http://dpaste.dzfl.pl/5655cbbe

copied out for those who don't want to go to dpaste:

import std.concurrency;
import std.stdio;

void main() {
    double[] a,b;
    a = [1.1];
    b = [2.2];
    int i= 3;

    auto tid = spawn(&foo);
	
    tid.send(a.idup, b.idup);    //works, no problem

    tid.send(a.idup, i);	 //so does this

    tid.send(a.idup, b.idup, i); //core.exception.AssertError@ 
std/variant.d(277): target must be non-null

}

void foo() {
    bool running  = true;
    while(running) {
     	receive(
	    (immutable(double)[] a, int i) {
		writeln(a, i);
	    },
	    (immutable(double)[] a, immutable(double)[] b, int i) {
		writeln(a, b, i);
	    },
	    (immutable(double)[] a, immutable(double)[] b) {
		writeln(a, b);
	    },
	    (OwnerTerminated e) {
		running = false;
	    }
	);
    }
}

This seems like a bug to me, but I don't know std.concurrency 
well enough to be sure.
December 07, 2012
Re: concurrency send() error
12/7/2012 4:40 PM, John Colvin пишет:
> I was messing about with std.concurrency and ran in to this:
> http://dpaste.dzfl.pl/5655cbbe
>
> copied out for those who don't want to go to dpaste:
>
[snip]
> This seems like a bug to me, but I don't know std.concurrency well
> enough to be sure.

It looks like a bug and it smells like a bug. I'd say it's a bug :)
Please go ahead and file it.

-- 
Dmitry Olshansky
Top | Discussion index | About this forum | D home