Threading errors.

Philippe Sigaud philippe.sigaud at gmail.com
Mon Jul 26 13:23:41 PDT 2010


On Mon, Jul 26, 2010 at 19:11, dcoder <dcoder at devnull.dev> wrote:

> == Quote from Rory Mcguire (rjmcguire at gm_no_ail.com)'s article
> > Dmitry Olshansky wrote:
>


std.typecons.Tuple fields cannot be indexed like arrays, Andrei made a
mistake. To access field  #n, use ._n or .field[n]. There is no difference
between the two.

void writer() {
 for( ;; ) {
   auto msg = receiveOnly!(Tid, int)(); // msg is a Tuple!(Tid, int), msg._0
is a Tid, msg._1 is an int.
   writeln( "Secondary thread: ", msg._1);
   msg._0.send(thisTid);
 }
}

Also, in my case, the return; in writer must be commented out, or DMD
complains it cannot be reached.


Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100726/9c914312/attachment.html>


More information about the Digitalmars-d-learn mailing list