You can always use poor man's closures: add a field that takes a tuple, for
proc + environment for example
type Foo = object
data: int
handler: tuple[onSignal: proc(env: pointer) {.nimcall.}, env: pointer]
RunYou can have an array of handlers or define multiple handlers in the proc.
