Examples
Use these examples when you want to copy a small shape and adapt it. Each page focuses on one decision instead of listing every API.
-
Spawn work, join it, sleep, and use interval timers.
-
Move values between tasks and wait on multiple channel operations.
-
Read and write without pinning scheduler workers.
-
Create explicit runtime handles for host-owned lifecycle.
-
Run foreign blocking code through LLAM compensation paths.
How examples are labeled
Examples are labeled by intent:
| Label | Meaning |
|---|---|
| Complete program | You can copy the whole block into a file and build around it. |
| Focused snippet | The block belongs inside an existing task, callback, or platform setup. |
| Platform-specific | The example depends on a named OS API such as POSIX socketpair() or Windows HANDLEs. |
Complete programs in the repository
The source tree also ships larger examples:
| Program | Purpose |
|---|---|
demo |
Small public runtime API walkthrough. |
bench |
Runtime microbenchmarks. |
stress |
Scheduler, sync, timeout, I/O, and dynamic-worker stress. |
server |
Best-effort LLAM-backed TCP chat server. |
server_lossless |
Chat server with outbox backpressure. |
server_flood |
Native throughput driver for the chat server. |
llam_broker |
Internal broker self-test and local transport smoke harness. |
Build them from source with:
make -j4
./demo
./bench
./server 7777
For production validation, use the commands in Verification.
Native C snippets in this section explicitly select *_compat runtimes.
The normal runtime constructors require asynchronous admission; use the
managed C guide to compile qualified task code for that path.