Main Content

本页采用了机器翻译。点击此处可查看英文原文。

cancelAll

取消所有作业或任务

自 R2022a 起

    说明

    cancelAll(p.FevalQueue) 停止指定池中所有排队或正在运行的元素。

    示例

    示例

    全部折叠

    创建一个并行池。

    pool = parpool;
    Starting parallel pool (parpool) using the 'Processes' profile ...
    Connected to the parallel pool (number of workers: 6).
    

    使用 parfeval 运行 pause(Inf) 而不检索任何输出。

    f = parfeval(pool,@pause,0,Inf);

    检查池中排队和运行的函数的状态。

    pool.FevalQueue
    ans = 
     FevalQueue with properties: 
    
            QueuedFutures: [0x0 parallel.FevalFuture]
           RunningFutures: [1x1 parallel.FevalFuture]
    
    

    使用 cancelAll 来停止 FevalQueue 中的所有 Futures

    cancelAll(pool.FevalQueue)
    pool.FevalQueue
    ans = 
     FevalQueue with properties: 
    
            QueuedFutures: [0x0 parallel.FevalFuture]
           RunningFutures: [0x0 parallel.FevalFuture]
    
    

    输入参数

    全部折叠

    要在后台池上运行的 FevalFuture 对象队列,指定为 FevalFuture 标量和 FevalFuture 数组。

    扩展功能

    版本历史记录

    在 R2022a 中推出

    另请参阅

    | |