diff --git a/M2/Macaulay2/d/pthread.d b/M2/Macaulay2/d/pthread.d index 5c123497b6c..00f0dd87ae5 100644 --- a/M2/Macaulay2/d/pthread.d +++ b/M2/Macaulay2/d/pthread.d @@ -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) diff --git a/M2/Macaulay2/packages/Macaulay2Doc/threads.m2 b/M2/Macaulay2/packages/Macaulay2Doc/threads.m2 index 0310dcb2c7c..53c0a0bfea0 100644 --- a/M2/Macaulay2/packages/Macaulay2Doc/threads.m2 +++ b/M2/Macaulay2/packages/Macaulay2Doc/threads.m2 @@ -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 @@ -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) @@ -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