concurrency call to arms

rikki cattermole rikki at cattermole.co.nz
Fri Aug 17 06:36:36 UTC 2018


After reading the article I can say, it isn't any better than async and 
await for dependencies. You still need an event loop.

The problem is that joining that happens at the end of that block needs 
to run the event loop for iterations until it completes. Which is 
wonderful if you're not doing real time like game development.

In essence you want a stack of state per thread, which uses the central 
event loop:

func():
	with x:
		spawn(foo)
		join(foo)
		endScope()
funcParent():
	with x:
		spawn(func)
		join(func)
		endScope()

If you don't have this, you will miss timers, window events and all 
sorts of things that could be very time sensitive which would be very 
very bad.

Because we have an event loop, we don't need a nursery! It comes free of 
charge. It also means we don't need that with statement... hang on that 
now becomes await and async! Just without the await (auto added in 
scope(exit), and compiler can merge them into a single function call ;) ).


More information about the Digitalmars-d mailing list