How are theads, Tid and spawn related?

Sean Kelly via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 1 23:14:57 PDT 2014


Note that thread_joinAll is called automatically when main exits,
so if you just want to be sure that your spawned thread completes
you don't have to do anything at all.

The decision to obscure the Thread object in std.concurrency was
deliberate, as it allows us to use more than just kernel threads
for concurrency. The thread may even live in another process and
the message sent via IPC. If you want to start an asynchronous
task and wait for it to complete I suggest the method Ali
outlines above. You can also create a Thread directly. What we
should really have for this sort of thing is futures, but they
don't exist yet. std.parallelism might be worth a look as well,
since it has a task queue.


More information about the Digitalmars-d-learn mailing list