Can/should spawn work with functions that return?

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Jan 21 15:23:37 PST 2011


Sorry, I should be careful with the word side-effects. What I meant
was the newly spawned thread does its own job that the main thread
doesn't care much about. It doesn't touch main's state or any shared
variables. It does some work other than return a value. But the
function I wanted the new thread to execute happened to have a return
value, so I couldn't spawn the thread.

Really, the issue is that sometimes I have to convert C code to D and
concurrency is dealt with differently in the two languages, not to
mention the fact that I have next to no experience with using threads
in any language (but I'm forced to use them in some cases).

So, sometimes I'll ask silly questions because I'm very new to this,
but hopefully I'll learn a thing or two. I do enjoy your long and
informative responses though, Jonathan. :)


More information about the Digitalmars-d-learn mailing list