Terminate a task

501 views
Skip to first unread message

Bob Cowdery

unread,
Mar 23, 2014, 11:27:18 AM3/23/14
to julia...@googlegroups.com
Is there any way to terminate a task that is stuck on a blocking call. I can see that I can call istaskdone() or start a Timeout to know that the task is potentially blocked but I don't see anything in Task that lets me terminate it.

Bob

Jameson Nash

unread,
Mar 23, 2014, 11:35:16 AM3/23/14
to julia...@googlegroups.com
You can throw an error in the task, or just allow the gc to delete it. 

Stefan Karpinski

unread,
Mar 23, 2014, 11:37:20 AM3/23/14
to Julia Users
I think the question is if there's a way to externally interrupt a task.

Bob Cowdery

unread,
Mar 23, 2014, 11:38:57 AM3/23/14
to julia...@googlegroups.com
Could you clarify please. If its on a blocking call how do I throw an error and if its not complete why would the gc delete it.

Amit Murthy

unread,
Mar 24, 2014, 1:01:07 AM3/24/14
to julia...@googlegroups.com
I think currently the only way to interrupt a task is when it is blocked on a condition variable by using the "notify" call. Will be good to have a "terminate(t::Task)" call.

Stefan Karpinski

unread,
Mar 24, 2014, 10:53:38 AM3/24/14
to Julia Users
Yes, we need this ability. Externally terminating and otherwise interacting with tasks is a good way to deal with things like timeouts and cancelling distributed work.

Jameson Nash

unread,
Mar 24, 2014, 12:44:47 PM3/24/14
to julia...@googlegroups.com
Alternatively, might be fun to make a ccall_in_worker_thread intrinsic which handles all of the fiddly gc details and only blocks the local task (and/or returns a remoteref)

Amit Murthy

unread,
Mar 27, 2014, 11:19:52 AM3/27/14
to julia...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages