How to create Multi Producer-Single Consumer concurrency

Ali Çehreli acehreli at yahoo.com
Wed Jul 13 19:06:48 UTC 2022


On 7/13/22 02:25, Bagomot wrote:

 > How to do the same with `taskPool` instead of `spawnLinked`?

You are hitting the nail on the head. :) std.parallelism, which taskPool 
is a concept of, is for cases where operations are independent.

However, producer and consumer are by definition dependent, so it's a 
problem for std.concurrency, which involves message boxes.

You can do the same with std.parallelism or core.thread but you would be 
implementing some of what std.concurrency already provides.

The following are my understandings of these topics:

   http://ddili.org/ders/d.en/parallelism.html

   http://ddili.org/ders/d.en/concurrency.html

   http://ddili.org/ders/d.en/concurrency_shared.html

The introduction section of the Concurrency chapter lists some differences.

Ali



More information about the Digitalmars-d-learn mailing list