interrupt
interrupt([pids...])
Interrupt the current executing task on the specified workers. This is equivalent to pressing Ctrl-C on the local machine. If no arguments are given, all workers are interrupted.
Examples
-
Interrupt the current task on local machine:
julia> interrupt()
This will interrupt the currently executing task on the local machine, simulating the effect of pressing Ctrl-C.
-
Interrupt specific worker tasks:
julia> interrupt(pids...)
This will interrupt the currently executing tasks on the specified worker processes identified by their process IDs (
pids
). - Interrupt all worker tasks:
julia> interrupt()
If no arguments are provided, this will interrupt all currently executing tasks on all workers.
Common mistake example:
julia> interrupt([2, 3])
ERROR: MethodError: objects of type Int64 are not callable
In this example, the mistake is passing the process IDs as an array [2, 3]
instead of as separate arguments. The correct way to pass multiple process IDs is by separating them with commas, like interrupt(2, 3)
.
See Also
:@async, :@schedule, :@task, Condition, consume, interrupt, istaskdone, istaskstarted, lock, notify, ReentrantLock, schedule, Task, task_local_storage, unlock, wait, yield, yieldto,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.