digitalmars.D.learn - How to call receiveTimout? (std.concurrency)
- Heywood Floyd (39/39) Jun 29 2010 Hello and Good morning!
- Simen kjaeraas (5/6) Jun 29 2010 Well, this looks like a bug to me. Should be
- Simen kjaeraas (4/8) Jun 29 2010 Oh, and you could probably make this change yourself.
- Steven Schveighoffer (5/9) Jun 29 2010 Ops is a type, isn't it? Don't you need a variable there?
- Heywood Floyd (8/24) Jun 29 2010 Ok, thanks!
- Steven Schveighoffer (12/18) Jun 29 2010 Simen actually already filed it. See here:
- Heywood Floyd (14/31) Jun 29 2010 Thanks!
Hello and Good morning! I'm trying to use receiveTimeout: // –––– import std.stdio, std.concurrency; int main(string[] args){ receiveTimeout( 1000L, (int i){writefln("Received: %d",i);} ) ; return 0; } // –––– (I removed all the surrounding code above that spawned threads etc.) Compiler gives me: /Library/Compilers/dmd2/osx/bin/../../src/phobos/std/concurrency.d(335): Error: mismatched tuple lengths, 2 and 1 I can't see what's wrong? Help! A look in concurrency.d shows: // - - 8< - - bool receiveTimeout(T...)( long ms, T ops ) { static enum long TICKS_PER_MILLI = 10_000; return mbox.get( ms * TICKS_PER_MILLI, ops ); } // - - 8< - - final void get(T...)( T ops ) { static assert( T.length ); static if( isImplicitlyConvertible!(T[0], long) ) { alias TypeTuple!(T[1 .. $]) Ops; assert( ops[0] >= 0 ); long period = ops[0]; ops = ops[1 .. $]; // <=== line 335 } // - - 8< - - (DMD v2.047, OSX 10.6.4) BR /soul PS. Sorry if this is a dupe. Mailman doesn't seem to like my emails? Sending this via the web- interface..
Jun 29 2010
Heywood Floyd <soul8o8 gmail.com> wrote:ops = ops[1 .. $]; // <=== line 335Well, this looks like a bug to me. Should be Ops = ops[1 .. $]; -- Simen
Jun 29 2010
Simen kjaeraas <simen.kjaras gmail.com> wrote:Heywood Floyd <soul8o8 gmail.com> wrote:Oh, and you could probably make this change yourself. -- Simenops = ops[1 .. $]; // <=== line 335Well, this looks like a bug to me. Should be Ops = ops[1 .. $];
Jun 29 2010
On Tue, 29 Jun 2010 09:53:25 -0400, Simen kjaeraas <simen.kjaras gmail.com> wrote:Heywood Floyd <soul8o8 gmail.com> wrote:Ops is a type, isn't it? Don't you need a variable there? I agree it's a bug in the original, but I don't think that's the fix. -Steveops = ops[1 .. $]; // <=== line 335Well, this looks like a bug to me. Should be Ops = ops[1 .. $];
Jun 29 2010
Ok, thanks! How does the chain of command/responsibility work here? Should I file this to bugzilla? (I'm not able to fix it myself as I haven't built dmd locally. I'm just = not quite there yet... : ) /heywood On Jun 29, 2010, at 16:31 , Steven Schveighoffer wrote:On Tue, 29 Jun 2010 09:53:25 -0400, Simen kjaeraas =<simen.kjaras gmail.com> wrote:=20Heywood Floyd <soul8o8 gmail.com> wrote: =20=20 Ops is a type, isn't it? Don't you need a variable there? =20 I agree it's a bug in the original, but I don't think that's the fix. =20 -Steveops =3D ops[1 .. $]; // <=3D=3D=3D line 335=20 Well, this looks like a bug to me. Should be =20 Ops =3D ops[1 .. $]; =20
Jun 29 2010
On Tue, 29 Jun 2010 13:05:50 -0400, Heywood Floyd <soul8o8 gmail.com> wrote:Ok, thanks! How does the chain of command/responsibility work here? Should I file this to bugzilla? (I'm not able to fix it myself as I haven't built dmd locally. I'm just not quite there yet... : ) /heywoodSimen actually already filed it. See here: http://d.puremagic.com/issues/show_bug.cgi?id=4406. In the future, just go to http://d.puremagic.com/issues and you can file the bug directly. It's good to ask on d.learn if you aren't sure. And this bug isn't in dmd, it's in phobos :) They are compiled separately (in case you are interested in trying your hand at phobos patches). All the releases come with the complete source code, just cd to the src directory and type make -f blah.mak where blah is your platform (posix, windows, etc.). -Steve
Jun 29 2010
Thanks! I will! /heywood PS. I like D. On Jun 29, 2010, at 19:37 , Steven Schveighoffer wrote:On Tue, 29 Jun 2010 13:05:50 -0400, Heywood Floyd <soul8o8 gmail.com> =wrote:=20just not quite there yet... : )=20 =20 Ok, thanks! =20 How does the chain of command/responsibility work here? Should I file this to bugzilla? =20 (I'm not able to fix it myself as I haven't built dmd locally. I'm =http://d.puremagic.com/issues/show_bug.cgi?id=3D4406. In the future, = just go to http://d.puremagic.com/issues and you can file the bug = directly. It's good to ask on d.learn if you aren't sure./heywood=20 Simen actually already filed it. See here: ==20 And this bug isn't in dmd, it's in phobos :) They are compiled =separately (in case you are interested in trying your hand at phobos = patches). All the releases come with the complete source code, just cd = to the src directory and type make -f blah.mak where blah is your = platform (posix, windows, etc.).=20 -Steve
Jun 29 2010