Stdlib module core/concurrency.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.

Visual portrait of core/concurrency.vitl
Wiki-style portrait for core/concurrency.vitl.

Family: core

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

FieldValue
Pathcore/concurrency.vitl
Familycore
Kindpublic stdlib surface
Line count360
Declared procedures32
Declared forms/picks8

`core/concurrency.vitl` is a public stdlib surface inside the `core` family. It should be read as one focused slice of the broader family responsibility: Portable low-level building blocks: types, strings, memory helpers, panic/runtime-adjacent basics, and reusable utility routines.

Purpose

This file should be chosen because of responsibility, not because its name “sounds close enough”. Inside the core family, it carries one focused part of the contract and keeps that responsibility separate from neighboring concerns.

  • A manifest validator stores names and counters with `core` types.
  • A pure helper normalizes a string or integer without touching host state.
  • The same helper can be reused in compiler code, stdlib code, and user code.

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.

  • Large algorithm surface: this file exposes many procedures and likely acts as a domain toolkit rather than a single thin wrapper.
  • Owns domain vocabulary: the module declares data shapes in addition to executable helpers, so its types are part of the contract.
  • Minimal top-level dependencies: the module reads as mostly self-contained from its opening declarations.
  • Explicit export surface: the file ends with visible export declarations instead of relying only on implicit namespace discovery.

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.

SignalCountWhat it suggests
if13Branching density and local decision-making.
while4Loop-heavy or iterative implementation style.
for0Collection-style traversal at source level.
match0Variant-driven branching or grammar-style decoding.
let15Local state and intermediate value density.
give42Number of explicit exit points and result shaping.

Top-level API inventory

SurfaceItems
Procedurestask, mutex, spinlock, semaphore, channel, runtime_stats, start_task, wait_task, complete_task, fail_task, cancel_task, task_running
FormsTask, Mutex, SpinLock, Semaphore, Channel, RuntimeStats
PicksTaskState, ChannelState
Constantsnone declared at top level
Exports*

Imported surfaces

This file does not advertise a top-level `use` surface in its opening declarations. That often means it is either self-contained or an aggregation layer.

Position in family

This file is module 3 of 9 in the core family when ordered by path. By procedure count it ranks 3, and by line count it ranks 5. 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.

LineNameKindRole
1vitte/stdlib/core/concurrencyspaceDeclares the namespace that anchors this file in the stdlib tree.
5TaskStatepickIntroduces a tagged variant type used to model distinct outcomes.
14ChannelStatepickIntroduces a tagged variant type used to model distinct outcomes.
19TaskformIntroduces a structured data shape that other procedures can exchange.
26MutexformIntroduces a structured data shape that other procedures can exchange.
31SpinLockformIntroduces a structured data shape that other procedures can exchange.
35SemaphoreformIntroduces a structured data shape that other procedures can exchange.
40ChannelformIntroduces a structured data shape that other procedures can exchange.
46RuntimeStatsformIntroduces a structured data shape that other procedures can exchange.
53taskprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
62mutexprocOwns coordination, scheduling, or concurrency behavior.
69spinlockprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
75semaphoreprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
82channelprocOwns coordination, scheduling, or concurrency behavior.
90runtime_statsprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
99start_taskprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
108wait_taskprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
117complete_taskprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
126fail_taskprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
135cancel_taskprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
144task_runningprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
148task_finishedprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
154lock_mutexprocOwns coordination, scheduling, or concurrency behavior.
165unlock_mutexprocOwns coordination, scheduling, or concurrency behavior.
180mutex_lockedprocOwns coordination, scheduling, or concurrency behavior.
184acquire_spinlockprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
194release_spinlockprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
204spinlock_lockedprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
208acquire_semaphoreprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
219release_semaphoreprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
230semaphore_availableprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
234send_messageprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
246receive_messageprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
254pop_messageprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
275close_channelprocOwns coordination, scheduling, or concurrency behavior.
283channel_openprocOwns coordination, scheduling, or concurrency behavior.
287count_running_tasksprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
303count_waiting_tasksprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
319count_completed_tasksprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
335build_runtime_statsprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
344concurrency_selftestprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.

The table is exhaustive for top-level declarations of the selected kinds. This file declares 41 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.

  • pick TaskState { (line 5)
  • pick ChannelState { (line 14)
  • form Task { (line 19)
  • form Mutex { (line 26)
  • form SpinLock { (line 31)
  • form Semaphore { (line 35)
  • form Channel { (line 40)
  • form RuntimeStats { (line 46)
  • proc task(task_id: u64, name: string) -> Task { (line 53)
  • proc mutex() -> Mutex { (line 62)
  • proc spinlock() -> SpinLock { (line 69)
  • proc semaphore(permits: int) -> Semaphore { (line 75)
  • proc channel(channel_id: u64) -> Channel { (line 82)
  • proc runtime_stats() -> RuntimeStats { (line 90)
  • proc start_task(task: Task) -> Task { (line 99)
  • proc wait_task(task: Task) -> Task { (line 108)
  • proc complete_task(task: Task) -> Task { (line 117)
  • proc fail_task(task: Task) -> Task { (line 126)

The list is intentionally capped here; the source file declares 40 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.

  1. Read space and top-level imports first so the ownership boundary of core/concurrency.vitl is explicit.
  2. Read declared forms and picks before algorithms so the data vocabulary is stable in your head.
  3. Traverse procedures in source order; the early helpers usually explain the naming and numeric conventions used later.
  4. 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/core_concurrency
form UserReport {
  label: string,
  ready: bool
}
pick UserOutcome {
  case Ready(message: string)
  case Empty(reason: string)
}
proc run_example() -> UserOutcome {
  let result = task(u64(), "sample")
  let ready: bool = task_running(Task())
  let failed: bool = false
  let stable: bool = ready and true
  let fallback: bool = ready or false
  let idx: int = 0
  while idx < 1 {
    set idx = idx + 1
  }
  if not ready {
    give UserOutcome.Empty("module not ready")
  }
    give UserOutcome.Ready("ok")
}
export run_example

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.

KeywordPresent in module sourceUsed in generated user example
spaceyesyes
formyesyes
pickyesyes
procyesyes
letyesyes
setyesyes
ifyesyes
whileyesyes
giveyesyes
exportyesyes
trueyesyes
falseyesyes
andyesyes
oryesyes
notyesyes

The generated snippet exercises every detected Vitte keyword used by this module.

Source shape

space vitte/stdlib/core/concurrency
export *
pick TaskState {
    Pending
    Running
    Waiting
    Completed
    Failed
    Cancelled
}

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/core/concurrency
  • Line 3: export *
  • Line 5: pick TaskState {
  • Line 14: pick ChannelState {
  • Line 19: form Task {
  • Line 26: form Mutex {
  • Line 31: form SpinLock {
  • Line 35: form Semaphore {

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: 42. Procedures: 32. Data surfaces: 8. Constants: 0.

First visible names: vitte/stdlib/core/concurrency, *, TaskState, ChannelState, Task, Mutex, SpinLock, Semaphore, Channel, RuntimeStats

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

LineNameSignatureRole
5TaskStatepick TaskState {Introduces a tagged variant type used to model distinct outcomes.
14ChannelStatepick ChannelState {Introduces a tagged variant type used to model distinct outcomes.
19Taskform Task {Introduces a structured data shape that other procedures can exchange.
26Mutexform Mutex {Introduces a structured data shape that other procedures can exchange.
31SpinLockform SpinLock {Introduces a structured data shape that other procedures can exchange.
35Semaphoreform Semaphore {Introduces a structured data shape that other procedures can exchange.
40Channelform Channel {Introduces a structured data shape that other procedures can exchange.
46RuntimeStatsform RuntimeStats {Introduces a structured data shape that other procedures can exchange.

Procedures

LineNameSignatureRole
53taskproc task(task_id: u64, name: string) -> Task {Represents one top-level surface in the file contract and should be read as part of the module boundary.
62mutexproc mutex() -> Mutex {Owns coordination, scheduling, or concurrency behavior.
69spinlockproc spinlock() -> SpinLock {Represents one top-level surface in the file contract and should be read as part of the module boundary.
75semaphoreproc semaphore(permits: int) -> Semaphore {Represents one top-level surface in the file contract and should be read as part of the module boundary.
82channelproc channel(channel_id: u64) -> Channel {Owns coordination, scheduling, or concurrency behavior.
90runtime_statsproc runtime_stats() -> RuntimeStats {Represents one top-level surface in the file contract and should be read as part of the module boundary.
99start_taskproc start_task(task: Task) -> Task {Represents one top-level surface in the file contract and should be read as part of the module boundary.
108wait_taskproc wait_task(task: Task) -> Task {Represents one top-level surface in the file contract and should be read as part of the module boundary.
117complete_taskproc complete_task(task: Task) -> Task {Represents one top-level surface in the file contract and should be read as part of the module boundary.
126fail_taskproc fail_task(task: Task) -> Task {Represents one top-level surface in the file contract and should be read as part of the module boundary.
135cancel_taskproc cancel_task(task: Task) -> Task {Represents one top-level surface in the file contract and should be read as part of the module boundary.
144task_runningproc task_running(task: Task) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
148task_finishedproc task_finished(task: Task) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
154lock_mutexproc lock_mutex(lock: Mutex, owner: u64) -> Mutex {Owns coordination, scheduling, or concurrency behavior.
165unlock_mutexproc unlock_mutex(lock: Mutex, owner: u64) -> Mutex {Owns coordination, scheduling, or concurrency behavior.
180mutex_lockedproc mutex_locked(lock: Mutex) -> bool {Owns coordination, scheduling, or concurrency behavior.
184acquire_spinlockproc acquire_spinlock(lock: SpinLock) -> SpinLock {Represents one top-level surface in the file contract and should be read as part of the module boundary.
194release_spinlockproc release_spinlock(lock: SpinLock) -> SpinLock {Represents one top-level surface in the file contract and should be read as part of the module boundary.
204spinlock_lockedproc spinlock_locked(lock: SpinLock) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
208acquire_semaphoreproc acquire_semaphore(sem: Semaphore) -> Semaphore {Represents one top-level surface in the file contract and should be read as part of the module boundary.
219release_semaphoreproc release_semaphore(sem: Semaphore) -> Semaphore {Represents one top-level surface in the file contract and should be read as part of the module boundary.
230semaphore_availableproc semaphore_available(sem: Semaphore) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
234send_messageproc send_message(ch: Channel, message: string) -> Channel {Represents one top-level surface in the file contract and should be read as part of the module boundary.
246receive_messageproc receive_message(ch: Channel) -> string {Represents one top-level surface in the file contract and should be read as part of the module boundary.
254pop_messageproc pop_message(ch: Channel) -> Channel {Represents one top-level surface in the file contract and should be read as part of the module boundary.
275close_channelproc close_channel(ch: Channel) -> Channel {Owns coordination, scheduling, or concurrency behavior.
283channel_openproc channel_open(ch: Channel) -> bool {Owns coordination, scheduling, or concurrency behavior.
287count_running_tasksproc count_running_tasks(tasks: [Task]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
303count_waiting_tasksproc count_waiting_tasks(tasks: [Task]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
319count_completed_tasksproc count_completed_tasks(tasks: [Task]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
335build_runtime_statsproc build_runtime_stats(tasks: [Task]) -> RuntimeStats {Represents one top-level surface in the file contract and should be read as part of the module boundary.
344concurrency_selftestproc concurrency_selftest() -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.

Exports

LineNameSignatureRole
3*export *Re-exports surfaces that the module wants to expose as part of its public boundary.

Integration boundaries

Within core, 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: Portable low-level building blocks: types, strings, memory helpers, panic/runtime-adjacent basics, and reusable utility routines.
  • Family architecture role: Use `core` when the code should remain portable and unsurprising. It is the family you reach for before involving the filesystem, network, process table, or threading runtime.

Composition guidance

Choose this module when

  • Choose core/concurrency.vitl when the main question is owned by this module rather than by transport, storage, orchestration, or user-interface code.
  • A manifest validator stores names and counters with `core` types.
  • A pure helper normalizes a string or integer without touching host state.
  • The same helper can be reused in compiler code, stdlib code, and user code.

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 core.
  • Check nearby modules such as core/algorithms.vitl, core/io_helpers.vitl, core/memory.vitl before 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.

NeighborProceduresData surfacesWhy compare it
core/algorithms.vitl182Shares the same family boundary but carries a distinct slice of responsibility.
core/io_helpers.vitl215Shares the same family boundary but carries a distinct slice of responsibility.
core/memory.vitl204Shares the same family boundary but carries a distinct slice of responsibility.
core/panic.vitl295Shares the same family boundary but carries a distinct slice of responsibility.
core/strings.vitl190Shares the same family boundary but carries a distinct slice of responsibility.
core/types.vitl335Shares the same family boundary but carries a distinct slice of responsibility.
core/utils.vitl223Shares the same family boundary but carries a distinct slice of responsibility.
core.vitl13116Shares the same family boundary but carries a distinct slice of responsibility.

Neighbor modules