How to pack types with variables in one message to send it to another thread? [tuple]
MarisaLovesUsAll via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Sep 7 03:42:36 PDT 2014
Hi!
I'm trying to make my program multithreaded, and I was stuck at
messaging between threads.
I need to pack types and variables into one message. Will I use
Tuples or something?
e.g.
class Sprite {};
send(tid, Sprite, "create", myInt);
................
Also I don't understand how to use Variant. Messages can be
different, and I don't know how to extract data from variant.
send(tid, "One", "Two", myInt);
receive(
(Variant args)
{
/*
args contains Tuple!(string, string, int)("One", "Two",
42);
I need simple access to data, e.g. args[0] args[1] args[2]
but I don't know how to do this
because `.get` method need precise type of Tuple
*/
}
);
Regards,
MarisaLovesUsAll
More information about the Digitalmars-d-learn
mailing list