Stdlib module async/executor.vitl
This page is a wiki-style reference for one concrete stdlib file. It explains what the file owns, where it fits in the family, and how to decide whether this is the right surface to depend on.
async/executor.vitl.Family: async
Kind: public stdlib surface
Page style: this reference follows the same “encyclopedic card + portrait + usage contract” logic as the keyword pages, but for stdlib modules.
Summary
- Overview
- Purpose
- Taxonomy
- Implementation profile
- Top-level API inventory
- Position in family
- Declaration map
- Representative signatures
- How to use this module
- User example
- Keyword coverage
- Source shape
- Source landmarks
- Source organization
- Complete API catalog
- Integration boundaries
- Composition guidance
- Relationship table
- Neighbor modules
Overview
| Field | Value |
|---|---|
| Path | async/executor.vitl |
| Family | async |
| Kind | public stdlib surface |
| Line count | 274 |
| Declared procedures | 18 |
| Declared forms/picks | 3 |
`async/executor.vitl` is a public stdlib surface inside the `async` family. It should be read as one focused slice of the broader family responsibility: Future, channel, executor, and task orchestration helpers.
Purpose
This file should be chosen because of responsibility, not because its name “sounds close enough”. Inside the async family, it carries one focused part of the contract and keeps that responsibility separate from neighboring concerns.
- Use this module when coordination and scheduling are explicit parts of the design.
- A pipeline can spawn tasks, exchange messages through channels, and join through the executor boundary.
Taxonomy
Think of this page as a generated encyclopedia entry rather than a hand-written tutorial. The goal is to show what kind of module this is, how dense it is, and what reading strategy makes sense before depending on it.
- Medium procedure surface: this file groups several related operations behind one namespace.
- Owns domain vocabulary: the module declares data shapes in addition to executable helpers, so its types are part of the contract.
- Narrow dependency fan-in: a small set of imports suggests a focused collaboration surface.
Implementation profile
This profile is inferred directly from the source text. It does not replace reading the file, but it tells you quickly whether the module is mostly declarative, loop-heavy, branch-heavy, or organized around many small exits.
| Signal | Count | What it suggests |
|---|---|---|
if | 11 | Branching density and local decision-making. |
while | 11 | Loop-heavy or iterative implementation style. |
for | 0 | Collection-style traversal at source level. |
match | 0 | Variant-driven branching or grammar-style decoding. |
let | 24 | Local state and intermediate value density. |
give | 23 | Number of explicit exit points and result shaping. |
Top-level API inventory
| Surface | Items |
|---|---|
| Procedures | executor_new, executor_spawn, executor_schedule_at, executor_run, run_task, check_scheduled_tasks, executor_pause, executor_resume, executor_task_state, executor_stats, executor_shutdown, executor_has_unfinished |
| Forms | Executor, Task, ExecutorStats |
| Picks | none declared at top level |
| Constants | none declared at top level |
| Exports | none declared at top level |
Imported surfaces
vitte/stdlib/core use vitte/stdlib/async/future // Executor manages async task execution // Implements event loop and work stealing scheduler form Executor { running
Position in family
This file is module 3 of 4 in the async family when ordered by path. By procedure count it ranks 4, and by line count it ranks 2. Those ranks are useful as rough signals of breadth, not as quality judgments.
Declaration map
The declaration map turns raw source into a scan-friendly catalog. It is useful when the file is large enough that a reader wants to orient by kinds of surfaces first.
| Line | Name | Kind | Role |
|---|---|---|---|
| 1 | vitte/stdlib/async/executor | space | Declares the namespace that anchors this file in the stdlib tree. |
| 3 | vitte/stdlib/core | use | Imports a sibling or supporting surface used by the module. |
| 4 | vitte/stdlib/async/future | use | Imports a sibling or supporting surface used by the module. |
| 9 | Executor | form | Introduces a structured data shape that other procedures can exchange. |
| 19 | Task | form | Introduces a structured data shape that other procedures can exchange. |
| 31 | executor_new | proc | Owns coordination, scheduling, or concurrency behavior. |
| 46 | executor_spawn | proc | Owns coordination, scheduling, or concurrency behavior. |
| 66 | executor_schedule_at | proc | Owns coordination, scheduling, or concurrency behavior. |
| 80 | executor_run | proc | Owns coordination, scheduling, or concurrency behavior. |
| 107 | run_task | proc | Represents one top-level surface in the file contract and should be read as part of the module boundary. |
| 130 | check_scheduled_tasks | proc | Represents one top-level surface in the file contract and should be read as part of the module boundary. |
| 146 | executor_pause | proc | Owns coordination, scheduling, or concurrency behavior. |
| 152 | executor_resume | proc | Owns coordination, scheduling, or concurrency behavior. |
| 158 | executor_task_state | proc | Owns coordination, scheduling, or concurrency behavior. |
| 170 | ExecutorStats | form | Introduces a structured data shape that other procedures can exchange. |
| 179 | executor_stats | proc | Owns coordination, scheduling, or concurrency behavior. |
| 208 | executor_shutdown | proc | Owns coordination, scheduling, or concurrency behavior. |
| 220 | executor_has_unfinished | proc | Owns coordination, scheduling, or concurrency behavior. |
| 232 | queue_shift | proc | Owns a concrete data shape or the operations that maintain it. |
| 246 | sleep_ms | proc | Represents one top-level surface in the file contract and should be read as part of the module boundary. |
| 250 | timestamp_now | proc | Represents one top-level surface in the file contract and should be read as part of the module boundary. |
| 254 | executor_version | proc | Owns coordination, scheduling, or concurrency behavior. |
| 258 | executor_ready | proc | Owns coordination, scheduling, or concurrency behavior. |
| 262 | executor_selftest | proc | Owns coordination, scheduling, or concurrency behavior. |
The table is exhaustive for top-level declarations of the selected kinds. This file declares 24 matching surfaces.
Representative signatures
These signatures are shown in source order so the page keeps the feel of a reference manual, not just a keyword cloud.
form Executor {(line 9)form Task {(line 19)proc executor_new(max_workers: int) -> Executor {(line 31)proc executor_spawn(exec: Executor, name: string, priority: int) -> int {(line 46)proc executor_schedule_at(exec: Executor, task_id: int, ms: int) -> bool {(line 66)proc executor_run(exec: Executor) -> int {(line 80)proc run_task(exec: Executor, task_id: int) -> int {(line 107)proc check_scheduled_tasks(exec: Executor) -> bool {(line 130)proc executor_pause(exec: Executor) -> bool {(line 146)proc executor_resume(exec: Executor) -> bool {(line 152)proc executor_task_state(exec: Executor, task_id: int) -> int {(line 158)form ExecutorStats {(line 170)proc executor_stats(exec: Executor) -> ExecutorStats {(line 179)proc executor_shutdown(exec: Executor) -> int {(line 208)proc executor_has_unfinished(exec: Executor) -> bool {(line 220)proc queue_shift(q: [int]) -> [int] {(line 232)proc sleep_ms(ms: int) -> bool {(line 246)proc timestamp_now() -> int {(line 250)
The list is intentionally capped here; the source file declares 21 matching signatures in total.
How to use this module
Start by reading the file as an ownership boundary. Ask three questions: what enters this module, what stable types or procedures it exports, and what adjacent module should stay outside of it.
- Read
spaceand top-level imports first so the ownership boundary ofasync/executor.vitlis explicit. - Read declared forms and picks before algorithms so the data vocabulary is stable in your head.
- Traverse procedures in source order; the early helpers usually explain the naming and numeric conventions used later.
- Only after that compare neighbor modules, because the right boundary choice matters more than memorizing one helper name.
User example
This example is generated from the actual stdlib module surface. Its job is not to be the smallest snippet possible; its job is to show a realistic consumer-shaped file that exercises the module and mirrors the language keywords the module itself relies on.
space demo/async_executor
use vitte/stdlib/async/executor
form UserReport {
label: string,
ready: bool
}
proc run_example() -> UserReport {
let entries = queue_shift([1, 2, 3])
let ready: bool = executor_schedule_at(Executor(), 1, 1)
let failed: bool = false
let stable: bool = ready and true
let fallback: bool = ready or false
let idx: int = 0
let count: int = 0
while idx < entries.len {
set count = count + 1
set idx = idx + 1
}
if ready {
give UserReport { label: "not-ready", ready: false }
}
give UserReport { label: "ok", ready: true }
}
Keyword coverage
This table makes the “all keywords of the module” requirement auditable. It compares the detected Vitte keywords in the source file with the generated consumer example above.
| Keyword | Present in module source | Used in generated user example |
|---|---|---|
space | yes | yes |
use | yes | yes |
form | yes | yes |
proc | yes | yes |
let | yes | yes |
set | yes | yes |
if | yes | yes |
while | yes | yes |
give | yes | yes |
at | yes | no |
true | yes | yes |
false | yes | yes |
and | yes | yes |
or | yes | yes |
Keywords still not exercised directly in the generated snippet: at. The page still lists them here so the gap is visible.
Source shape
space vitte/stdlib/async/executor
use vitte/stdlib/core
use vitte/stdlib/async/future
// Executor manages async task execution
// Implements event loop and work stealing scheduler
form Executor {
running: bool,
tasks: [Task],
task_counter: int,
ready_queue: [int],
The excerpt is not meant to replace the file. It exists to make the module recognizable at first glance, the same way a Wikipedia infobox helps the reader orient before reading the whole article.
Source landmarks
Large files are easier to retain when they have visible landmarks. When the source contains explicit section banners, they are surfaced here; otherwise the first major declarations are used as anchors.
- Line 1:
space vitte/stdlib/async/executor - Line 3:
use vitte/stdlib/core - Line 4:
use vitte/stdlib/async/future - Line 9:
form Executor { - Line 19:
form Task { - Line 31:
proc executor_new(max_workers: int) -> Executor { - Line 46:
proc executor_spawn(exec: Executor, name: string, priority: int) -> int { - Line 66:
proc executor_schedule_at(exec: Executor, task_id: int, ms: int) -> bool {
Source organization
When a file carries its own internal chaptering, those chapters usually reveal the intended reading order better than a flat symbol list. This section reconstructs that organization from the source itself.
File surfaces
Top-level items: 24. Procedures: 18. Data surfaces: 3. Constants: 0.
First visible names: vitte/stdlib/async/executor, vitte/stdlib/core, vitte/stdlib/async/future, Executor, Task, executor_new, executor_spawn, executor_schedule_at, executor_run, run_task
Complete API catalog
This catalog is the exhaustive file-level index for the module. It is intentionally closer to a generated encyclopedia appendix than to a tutorial summary.
Data surfaces
| Line | Name | Signature | Role |
|---|---|---|---|
| 9 | Executor | form Executor { | Introduces a structured data shape that other procedures can exchange. |
| 19 | Task | form Task { | Introduces a structured data shape that other procedures can exchange. |
| 170 | ExecutorStats | form ExecutorStats { | Introduces a structured data shape that other procedures can exchange. |
Procedures
| Line | Name | Signature | Role |
|---|---|---|---|
| 31 | executor_new | proc executor_new(max_workers: int) -> Executor { | Owns coordination, scheduling, or concurrency behavior. |
| 46 | executor_spawn | proc executor_spawn(exec: Executor, name: string, priority: int) -> int { | Owns coordination, scheduling, or concurrency behavior. |
| 66 | executor_schedule_at | proc executor_schedule_at(exec: Executor, task_id: int, ms: int) -> bool { | Owns coordination, scheduling, or concurrency behavior. |
| 80 | executor_run | proc executor_run(exec: Executor) -> int { | Owns coordination, scheduling, or concurrency behavior. |
| 107 | run_task | proc run_task(exec: Executor, task_id: int) -> int { | Represents one top-level surface in the file contract and should be read as part of the module boundary. |
| 130 | check_scheduled_tasks | proc check_scheduled_tasks(exec: Executor) -> bool { | Represents one top-level surface in the file contract and should be read as part of the module boundary. |
| 146 | executor_pause | proc executor_pause(exec: Executor) -> bool { | Owns coordination, scheduling, or concurrency behavior. |
| 152 | executor_resume | proc executor_resume(exec: Executor) -> bool { | Owns coordination, scheduling, or concurrency behavior. |
| 158 | executor_task_state | proc executor_task_state(exec: Executor, task_id: int) -> int { | Owns coordination, scheduling, or concurrency behavior. |
| 179 | executor_stats | proc executor_stats(exec: Executor) -> ExecutorStats { | Owns coordination, scheduling, or concurrency behavior. |
| 208 | executor_shutdown | proc executor_shutdown(exec: Executor) -> int { | Owns coordination, scheduling, or concurrency behavior. |
| 220 | executor_has_unfinished | proc executor_has_unfinished(exec: Executor) -> bool { | Owns coordination, scheduling, or concurrency behavior. |
| 232 | queue_shift | proc queue_shift(q: [int]) -> [int] { | Owns a concrete data shape or the operations that maintain it. |
| 246 | sleep_ms | proc sleep_ms(ms: int) -> bool { | Represents one top-level surface in the file contract and should be read as part of the module boundary. |
| 250 | timestamp_now | proc timestamp_now() -> int { | Represents one top-level surface in the file contract and should be read as part of the module boundary. |
| 254 | executor_version | proc executor_version() -> string { | Owns coordination, scheduling, or concurrency behavior. |
| 258 | executor_ready | proc executor_ready() -> bool { | Owns coordination, scheduling, or concurrency behavior. |
| 262 | executor_selftest | proc executor_selftest() -> bool { | Owns coordination, scheduling, or concurrency behavior. |
Imports
| Line | Name | Signature | Role |
|---|---|---|---|
| 3 | vitte/stdlib/core | use vitte/stdlib/core | Imports a sibling or supporting surface used by the module. |
| 4 | vitte/stdlib/async/future | use vitte/stdlib/async/future | Imports a sibling or supporting surface used by the module. |
Integration boundaries
Within async, this file should remain focused. If a future helper changes the host boundary, scheduling boundary, or data-shape boundary, it probably belongs in a neighbor module instead of being added here by convenience.
- Family responsibility: Future, channel, executor, and task orchestration helpers.
- Family architecture role: Use `async` when work should be coordinated as tasks rather than as direct thread ownership.
Composition guidance
Choose this module when
- Choose
async/executor.vitlwhen the main question is owned by this module rather than by transport, storage, orchestration, or user-interface code. - Use this module when coordination and scheduling are explicit parts of the design.
- A pipeline can spawn tasks, exchange messages through channels, and join through the executor boundary.
Pause before extending it when
- Avoid extending this file when the new helper mostly changes the boundary to host I/O, runtime coordination, or foreign integration instead of staying inside
async. - Check nearby modules such as
async/async.vitl,async/channel.vitl,async/future.vitlbefore adding convenience wrappers here.
Relationship table
This table keeps the page closer to a real encyclopedia entry: a module is easier to understand when compared with its nearest alternatives in the same family.
| Neighbor | Procedures | Data surfaces | Why compare it |
|---|---|---|---|
async/async.vitl | 29 | 3 | Shares the same family boundary but carries a distinct slice of responsibility. |
async/channel.vitl | 24 | 3 | Shares the same family boundary but carries a distinct slice of responsibility. |
async/future.vitl | 24 | 1 | Shares the same family boundary but carries a distinct slice of responsibility. |