Members
(static, constant) TASK_THREAD_WATERMARK
Live Task threads at which launchTask() starts refusing. See the bound above.
- Default Value
- 50
- Source
Methods
(static) admitTaskLaunch(node) → {boolean}
Records node and decides whether its launch may proceed.
Returns false when the app is at or above the watermark, in which case the node is NOT recorded — a refused launch starts no thread, so counting it would inflate the ledger on exactly the path that must not spiral.
| Name | Type | Description |
|---|---|---|
node | object |
- Source
- Type:
- boolean
(static) countLiveTaskThreads(ledger) → {integer}
Counts the tracked nodes whose Task thread is still running.
This is the app's own launches only — it excludes the main and render threads and anything started outside launchTask().
| Name | Type | Description |
|---|---|---|
ledger | object |
- Source
- Type:
- integer
(static) launchTask(node) → {boolean}
Starts node's Task thread through the accounted chokepoint.
call site checks this today; see the invalid-node note below before deciding you want to.
| Name | Type | Description |
|---|---|---|
node | object | the Task node to start |
- Source
true when the node was valid and RUN was issued, false otherwise. No
- Type:
- boolean
(static) printTaskThreads() → {void}
Prints the ledger to the BrightScript console (telnet port 8085).
Callable from a paused console the same way as the debug flags: printTaskThreads()
- Source
- Type:
- void
(static) pruneTaskLedger(ledger, node) → {object}
Returns ledger with finished threads dropped and node recorded.
Pruning at launch (rather than at read) keeps the ledger bounded without depending on anyone calling the readout: it holds the tasks live right now plus any that finished since the previous launch.
node is appended unconditionally and de-duplicated against the existing entries, because a persistent Task node gets relaunched many times over its life (ExtrasRowList alone relaunches its nodes 38 times).
| Name | Type | Description |
|---|---|---|
ledger | object | |
node | object |
- Source
- Type:
- object
(static) recordTaskLaunch(store, node) → {object}
Records node into store's ledger, creating the field on first use.
The field is CREATED here rather than assumed to exist, because a write to a field an roSGNode does not have is a silent no-op. Measured on device: with the field declared at the end of setGlobalNodes(), the five Task threads that setGlobalNodes() starts before that line — the three ApiTasks, ApiQueueTask and SideEffectTask — were dropped without a trace, and printTaskThreads() under-reported by a permanent five. Creating on first use makes the ledger correct whatever order bootstrap and launches happen in, so the bug cannot come back by someone adding a launch earlier.
store is passed in rather than read from m.global so this stays outside the #if debug shell and a Rooibos test can drive it — test builds compile with debug=false, so anything inside the gate is unreachable from Rooibos.
| Name | Type | Description |
|---|---|---|
store | object | |
node | object |
- Source
- Type:
- object
(static) taskThreadIsLive(node) → {boolean}
True while node's Task thread is running.
"init" counts: a node told to RUN has not necessarily entered its function yet, but it is already holding a thread. A node that has never been launched also reports "init", which is why only nodes the ledger has recorded are ever passed here.
| Name | Type | Description |
|---|---|---|
node | object |
- Source
- Type:
- boolean