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.
Re: How are theads, Tid and spawn related?
Sean Kelly via Digitalmars-d-learn Sat, 01 Nov 2014 23:16:49 -0700
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.
- How are theads, Tid and spawn relate... Neven via Digitalmars-d-learn
- Re: How are theads, Tid and spa... Ali Çehreli via Digitalmars-d-learn
- Re: How are theads, Tid and spa... Sean Kelly via Digitalmars-d-learn
- Re: How are theads, Tid and... Ali Çehreli via Digitalmars-d-learn
- Re: How are theads, Tid... Sean Kelly via Digitalmars-d-learn
- Re: How are theads,... Ali Çehreli via Digitalmars-d-learn
- Re: How are th... Sean Kelly via Digitalmars-d-learn
- Re: How are theads, Tid and spa... Sean Kelly via Digitalmars-d-learn
- Re: How are theads, Tid and spa... Russel Winder via Digitalmars-d-learn