dart:isolate
庫中Isolate構造函數
的用法介紹如下。
用法:
Isolate(
SendPort controlPort,
{Capability? pauseCapability,
Capability? terminateCapability}
)
創建具有一組受限函數的新 Isolate 對象。
該端口應該是隔離的控製端口,取自另一個 Isolate
對象。
這些能力應該是原始隔離可用的能力的子集。隔離的函數被鎖定到該隔離,並且在其他任何地方都沒有影響,因此這些函數應該來自與控製端口相同的隔離。
也可用於從控製端口創建 Isolate 對象,以及通過 SendPort 發送的任何可用函數。
例子:
Isolate isolate = findSomeIsolate();
Isolate restrictedIsolate = Isolate(isolate.controlPort);
untrustedCode(restrictedIsolate);
此示例創建一個新的 Isolate
對象,該對象不能用於暫停或終止隔離。不受信任的代碼所能做的就是檢查隔離並查看未捕獲的錯誤或何時終止。
相關用法
- Dart Iterator用法及代碼示例
- Dart Iterable.takeWhile用法及代碼示例
- Dart Int32x4List.view用法及代碼示例
- Dart ImmutableListMixin.replaceRange用法及代碼示例
- Dart IterableMixin.isNotEmpty用法及代碼示例
- Dart IterableMixin.firstWhere用法及代碼示例
- Dart IterableMixin.lastWhere用法及代碼示例
- Dart Iterable.skipWhile用法及代碼示例
- Dart IterableMixin.every用法及代碼示例
- Dart Iterable.toSet用法及代碼示例
- Dart ImmutableListMixin.insert用法及代碼示例
- Dart Int64List.sublist用法及代碼示例
- Dart Iterable.singleWhere用法及代碼示例
- Dart Iterable.reduce用法及代碼示例
- Dart Iterable.elementAt用法及代碼示例
- Dart ImmutableListMixin.addAll用法及代碼示例
- Dart Iterable.where用法及代碼示例
- Dart IterableMixin.take用法及代碼示例
- Dart ImmutableListMixin.shuffle用法及代碼示例
- Dart Iterable.lastWhere用法及代碼示例
- Dart ImmutableListMixin.retainWhere用法及代碼示例
- Dart IterableMixin.any用法及代碼示例
- Dart ImmutableListMixin.removeLast用法及代碼示例
- Dart Iterable.contains用法及代碼示例
- Dart IOOverrides用法及代碼示例
注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 Isolate constructor。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。