Skip to content

Commit

Permalink
Raise an error when calling taskResult on an unscheduled task
Browse files Browse the repository at this point in the history
Otherwise, M2 hangs waiting for a task that will never start
  • Loading branch information
d-torrance committed Nov 21, 2024
1 parent 507e642 commit 7587098
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions M2/Macaulay2/d/pthread.d
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ setupfun("schedule",schedule);
taskResult(e:Expr):Expr := (
when e is c:TaskCell do
if c.body.resultRetrieved then buildErrorPacket("task result already retrieved")
else if !taskReady(c.body.task)
then buildErrorPacket("task not scheduled yet")
else if !taskKeepRunning(c.body.task) then buildErrorPacket("task canceled")
else if !taskDone(c.body.task) then (
Ccode(voidPointer, "waitOnTask(",c.body.task,")");
Expand Down

0 comments on commit 7587098

Please sign in to comment.