cancelAll
说明
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]
输入参数
p.FevalQueue
— 在后台池中运行的 FevalFuture
对象队列
FevalFuture
标量 | FevalFuture
数组
要在后台池上运行的 FevalFuture
对象队列,指定为 FevalFuture
标量和 FevalFuture
数组。
扩展功能
基于线程的环境
使用 MATLAB® backgroundPool
在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool
加快代码运行速度。
该函数完全支持基于线程的环境。有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
版本历史记录
在 R2022a 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)