std.paralellism.Task value type problems
Ryan via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Oct 19 09:16:22 PDT 2016
On Wednesday, 19 October 2016 at 15:28:25 UTC, Benjamin Thaut
wrote:
> I would like to use std.paralellism.TaskPool to schedule
> various tasks I create. The problem however is that these tasks
> don't have a lifetime which is bound to any function scope I
> have. So I need to create a new task object on the heap and
> push it into a array for bookkeeping. The problem however is
> that std.paralellism.Task is a struct and the only way to
> instanciate it is to use std.paralelism.task which returns it
> as a value. I have no idea at the moment how to allocate a
> instance of std.paralellism.Task on the heap. Any suggestions?
>
> Kind Regards
> Benjamin Thaut
Try the link below for the documentation. There are 2 versions of
task, one returns a struct on the stack, the second returns a
struct on the GC heap.
https://dlang.org/phobos/std_parallelism.html#.task
More information about the Digitalmars-d-learn
mailing list