# task

Name or start asynchronous work

Last updated: 2026-09-09

Package: language | Status: experimental

Tags: complete-program, concurrency, cpu, keyword, yeho

Use a task when useful work can progress independently and you can define completion, failure, cancellation, and ownership.

```yh
task
```


## Task cleanup

Use a task when useful work can progress independently and you can define completion, failure, cancellation, and ownership.

Verification: type checked

```yh
FinishDuringShutdown()
{
    wait 10ms
    Console.Log("cleanup-complete")
}

task cleanupTask = task FinishDuringShutdown()

```

Save this beside start.yh as project.mech:

```toml
package = "tests.compiler.errorsTasksEffects.taskCleanup"
version = "0.1.0"
backend = "cpu-oracle"
osTarget = "windows"
archTarget = "x64"
selfContainedApp = false

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/word--task/complete --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Task, parallel, and tunnel behavior varies by target and remains experimental.

Do not discard a task unless its lifecycle and failure are intentionally unobserved.

Source: yeho/errors-tasks-effects-2026.1.json; tests/compiler/errors-tasks-effects/task-lifecycle/start.yh

AI training permission: https://demonhunterlabs.com/ai-use
