On 2013-03-27 16:34, Vidar Wahlberg wrote:

- I find myself in a world of pain when I want to share data more
complex than the basic data types (int, char, byte, etc) across threads.
Seemingly the magic trick is to "cast(shared) foo" (or
"cast(immutable)") when passing objects/references to another thread,
then "cast(Foo)" back on the receiving end (as most classes/structs in
the standard library refuse to let you call any methods when the object
is shared). The examples in the source and TDPL are fairly limited on
the issue, it mostly covers only those basic data types.

Try message passing and serialize the data you want to send.

Message passing: http://dlang.org/phobos/std_concurrency.html
Serialization: https://github.com/jacob-carlborg/orange

--
/Jacob Carlborg

Reply via email to