Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
June 29, 2010 How to call receiveTimout? (std.concurrency) | ||||
---|---|---|---|---|
| ||||
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.. |
June 29, 2010 Re: How to call receiveTimout? (std.concurrency) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Heywood Floyd | Heywood Floyd <soul8o8@gmail.com> wrote: > ops = ops[1 .. $]; // <=== line 335 Well, this looks like a bug to me. Should be Ops = ops[1 .. $]; -- Simen |
June 29, 2010 Re: How to call receiveTimout? (std.concurrency) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen kjaeraas | Simen kjaeraas <simen.kjaras@gmail.com> wrote: > Heywood Floyd <soul8o8@gmail.com> wrote: > >> ops = ops[1 .. $]; // <=== line 335 > > Well, this looks like a bug to me. Should be > > Ops = ops[1 .. $]; Oh, and you could probably make this change yourself. -- Simen |
June 29, 2010 Re: How to call receiveTimout? (std.concurrency) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen kjaeraas | On Tue, 29 Jun 2010 09:53:25 -0400, Simen kjaeraas <simen.kjaras@gmail.com> wrote:
> Heywood Floyd <soul8o8@gmail.com> wrote:
>
>> ops = ops[1 .. $]; // <=== line 335
>
> Well, this looks like a bug to me. Should be
>
> Ops = ops[1 .. $];
>
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.
-Steve
|
June 29, 2010 Re: How to call receiveTimout? (std.concurrency) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer |
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:
>
>> Heywood Floyd <soul8o8@gmail.com> wrote:
>>
>>> ops = ops[1 .. $]; // <=== line 335
>>
>> Well, this looks like a bug to me. Should be
>>
>> Ops = ops[1 .. $];
>>
>
> 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.
>
> -Steve
|
June 29, 2010 Re: How to call receiveTimout? (std.concurrency) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Heywood Floyd | 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... : ) > /heywood Simen 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 |
June 30, 2010 Re: How to call receiveTimout? (std.concurrency) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer |
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:
>
>>
>>
>> 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
>
> Simen 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
|
Copyright © 1999-2021 by the D Language Foundation