搜尋套件、儲存庫與 APP 分類

GitHub 儲存庫maxim-saplin/isolate_pool_2

isolate_pool_2

就像執行緒池一樣,但使用的是隔離區

isolate_pool_2 專案封面
星標
10
分支
5
最近推送(UTC)
2024年11月28日
專案狀態
未封存

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

The package provides APIs for creating and keeping active Dart isolates (an isolate pool) ready to receive requests, do the processing and provide results.

The best way to learn how to use the package is to check the provided example... Or clone the repo, open it in VSCode and run unit tests.

Use-case one - pooled jobs (Request <-> Response)

The pool can accept one-time requests (pooled jobs) mimicking Flutter's compute() method. But instead of spawning a new isolate each time it will use one of the available active isolates from the pool. In order to do so you need to inherit PooledJob class, define whatever params are needed as class fields, override the job() method that will be executed on pooled isolate. Use IsolatePool.scheduleJob() and pass an instance of pooled job in order to get it transferred to another isolate, executed and result returned.

Use-case two - persistant remote objects (aka pooled instances)

The second way of using the APIs is to have an instance created in one of the pooled isolates and communicate with it via a proxy instance, It is kind of messaging from the main isolate to one of the isolates in a pool with multiple instances created in multiple isolates, messages and responses properly correlated and arranged via descendants of Action. You can wrap PooledInstanceProxy in a class and mimic RPC kind of communication with PooledInstance in external isolate.

Pooled Instance - How it works

Diagram

Maxim Saplin GitHub avatar
GitHub 作者

Maxim Saplin ↗

EPAM Systems Europe
語言Dart

分類

使用的依賴

依賴清單 2 項

如何選擇適合專案的儲存庫?

先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。

  1. 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
  2. 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
  3. 使用前在 GitHub 確認 README、授權條款與 Issues。

來源與維護

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗