Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » parallel programming with threads and tasks » addDependencyTask(Task,Task)
next | previous | forward | backward | up | index | toc

addDependencyTask(Task,Task) -- schedule a task, but ensure that it will not run until another task finishes

Description

i1 : for i to 5 do t_i = createTask(() -> i)
i2 : for i from 1 to 5 do addDependencyTask(t_i, t_(i - 1))
i3 : schedule t_0

o3 = <<task, created>>

o3 : Task
i4 : sleep 1

o4 = 0
i5 : taskResult t_5

o5 = 5

Ways to use this method:


The source of this document is in Macaulay2Doc/ov_threads.m2:498:0.