On Monday, 4 August 2014 at 14:56:36 UTC, Philippe Sigaud via Digitalmars-d-learn wrote:
On Mon, Aug 4, 2014 at 3:36 PM, Dicebot via Digitalmars-d-learn
<digitalmars-d-learn@puremagic.com> wrote:
Modern default approach is to have amount of "worker" threads identical or close to amount of CPU cores and handle internal scheduling manually via
fibers or some similar solution.

That's what I guessed. It's juste that I have task that will generate
other (linked) tasks, in a DAG. I can use a thread pool of 2-8
threads, but that means storing tasks and their relationships (which is waiting on which, etc). I rather liked the idea of spawning new
threads when I needed them ;)

If you can live with the fact that your tasks might not be truly parallel (i.e. don't use busy waiting or other things that assume that other tasks make progress while a specific task is running), and you only use them for computing (no synchronous I/O), you can still use the fibers in core.thread:

http://dlang.org/phobos/core_thread.html#.Fiber

Reply via email to