language · keyword ·

task

Name or start asynchronous work

complete-programconcurrencycpukeywordyeho

Use a task when useful work can progress independently and you can define completion, failure, cancellation, and ownership.

task

Status: experimental

Task cleanup

Use a task when useful work can progress independently and you can define completion, failure, cancellation, and ownership.

cpu · complete-program · type checked

FinishDuringShutdown()
{
    wait 10ms
    Console.Log("cleanup-complete")
}

task cleanupTask = task FinishDuringShutdown()
project.mech
package = "tests.compiler.errorsTasksEffects.taskCleanup"
version = "0.1.0"
backend = "cpu-oracle"
osTarget = "windows"
archTarget = "x64"
selfContainedApp = false
Notes and source

Task, parallel, and tunnel behavior varies by target and remains experimental.

Do not discard a task unless its lifecycle and failure are intentionally unobserved.

yeho/errors-tasks-effects-2026.1.json; tests/compiler/errors-tasks-effects/task-lifecycle/start.yh