語言

ThreadPoolExecutor.AllowCoreThreadTimeOut(Boolean) 方法

定義

設定政策,規定若核心執行緒在保持有效時間內無任務抵達,是否可逾時終止,若有新任務抵達,則可重新啟用。

[Android.Runtime.Register("allowCoreThreadTimeOut", "(Z)V", "GetAllowCoreThreadTimeOut_ZHandler")]
public virtual void AllowCoreThreadTimeOut(bool value);
[<Android.Runtime.Register("allowCoreThreadTimeOut", "(Z)V", "GetAllowCoreThreadTimeOut_ZHandler")>]
abstract member AllowCoreThreadTimeOut : bool -> unit
override this.AllowCoreThreadTimeOut : bool -> unit

參數

value
Boolean

true 如果應該超時,否則 false

屬性

例外狀況

若值為 且 true 當前保持活絡時間不大於零

備註

設定政策,規定若核心執行緒在保持有效時間內無任務抵達,是否可逾時終止,若有新任務抵達,則可重新啟用。 當執行緒為錯誤時,核心執行緒不會因缺乏輸入任務而終止。 若屬實,同樣的「保持生命」政策適用於非核心執行緒,也適用於核心執行緒。 為避免持續更換執行緒,設定 true時保持存活時間必須大於零。 此方法通常應在池子被積極使用前就呼叫。

新增於1.6版本。

Java 文件 java.util.concurrent.ThreadPoolExecutor.allowCoreThreadTimeOut(boolean)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於