Skip to content

Commit

Permalink
Merge pull request #2942 from d-torrance/task-docs
Browse files Browse the repository at this point in the history
Improve some parallelization docs
  • Loading branch information
DanGrayson authored Oct 10, 2023
2 parents 9f2f863 + 1493811 commit 5ccd34f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion M2/Macaulay2/d/pthread.d
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ schedule2(fun:Expr,arg:Expr):Expr := (

schedule1(task:TaskCell):Expr := (
if taskStarted(task.body.task) then
WrongArg("A task that hasn't started")
WrongArg("a task that hasn't started")
else (
pushTask(task.body.task);
Expr(task)
Expand Down
16 changes: 15 additions & 1 deletion M2/Macaulay2/packages/Macaulay2Doc/threads.m2
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ Node
x:Thing
Outputs
:Task
a task, which when scheduled, will apply the function {\tt f} to the argument {\tt x}. In the
which when scheduled, will apply the function {\tt f} to the argument {\tt x}. In the
second form, where {\tt x} is not specified, it is take to be {\tt ()}.
Description
Example
Expand All @@ -272,6 +272,13 @@ Node
Item
the task {\tt t} will be scheduled for execution, but execution will not begin until the
task {\tt u} finishes
Description
Example
for i to 5 do t_i = createTask(() -> i)
for i from 1 to 5 do addDependencyTask(t_i, t_(i - 1))
schedule t_0
while not isReady t_5 do nanosleep 1000000
taskResult t_5
Node
Key
(addStartTask, Task, Task)
Expand Down Expand Up @@ -386,6 +393,13 @@ Node
Outputs
:
whether the task {\tt t} has been canceled
Description
Example
t = schedule(() -> while true do null)
isCanceled t
cancelTask t
while not isCanceled t do nanosleep 1000000
isCanceled t
SeeAlso
"parallel programming with threads and tasks"
cancelTask
Expand Down

0 comments on commit 5ccd34f

Please sign in to comment.