"Spawn as many thousand threads as you like" and D

Bienlein via Digitalmars-d digitalmars-d at puremagic.com
Wed May 7 08:28:39 PDT 2014


> I still don't understand what you mean by "distributed". 
> Spawning 50.000 tasks:
>
> 	import vibe.core.core;
> 	import std.stdio;
> 	
> 	void main()
> 	{
> 	    foreach (i; 0 .. 50_000)
> 		runTask({
> 			writefln("Hello, World!");
> 		});
> 	}
>
> Alternatively, runWorkerTask will also distribute the tasks 
> among a set of worker threads, which would be more in line with 
> Go AFAIK.

Hello Sönke,

would it be possible in vibe.d to spawn a task the usual 
actor-style way as it is done with kernel threads in D? What I 
mean is this:

void spawnedFunc(Tid tid)
{
    receive(
      (int i) { writeln("Received the number ", i);}
    );

}

auto tid = spawn(&spawnedFunc, thisTid);


Thanks, Bienlein


More information about the Digitalmars-d mailing list