# Module /runtime

Multi-threaded Tokio async runtime construction and blocking entry points (Async-Runtime, run, block-on).

```tangu
(use /runtime)
```

## Functions & symbols

### Async-Runtime

`(Async-Runtime) -> AsyncRuntime`

Constructs a multi-threaded Tokio `AsyncRuntime` instance.

```tangu
(let rt (runtime/Async-Runtime))
```

### Async-Runtime-construct

`(Async-Runtime-construct) -> AsyncRuntime`

Underlying constructor backing `(Async-Runtime)`.

```tangu
(let rt (runtime/Async-Runtime-construct))
```

### block-on

`(block-on rt func) -> Any`

Executes `func` on `rt` and blocks until all spawned async operations complete.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `rt` | `AsyncRuntime` | no | Runtime instance |
| `func` | `Func` | no | Zero-argument closure executed inside `rt` |

```tangu
(runtime/block-on rt (Func () (run-server)))
```

### run

`(run rt func) -> Any`

Dynamically binds `*runtime*` to `rt` and drives `func` to completion.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `rt` | `AsyncRuntime` | no | Runtime instance |
| `func` | `Func` | no | Zero-argument closure run with `*runtime*` dynamically bound to `rt` |

```tangu
(runtime/run (runtime/Async-Runtime) (Func () (main)))
```
