channel-timeout

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

channel-timeout shows the cancellable receive pattern: a Go callback that blocks on a channel reads L.Context() and selects on its Done() channel, so a SetContext deadline frees the goroutine instead of blocking forever. This is the recommended way to do blocking I/O in a callback — a plain <-ch would ignore the deadline (the VM only checks the context between instructions).

On timeout recv raises a clean, position-prefixed error with L.RaiseError (PUC luaL_error), which the script catches with pcall — so a stuck receive surfaces as a normal Lua error instead of hanging.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL