add a comment about async code and TK

This commit is contained in:
2025-05-11 23:50:39 -04:00
parent 68a725b5ce
commit 2f07a40116

10
main.go
View File

@@ -194,6 +194,16 @@ func moveSelectInFileList(target int) {
}
}
// TODO: by default, the event callback loop in TK is fully synchronous;
// each event only arrives after the previous event has finished processing.
// I'd like to make it so that multiple arrow presses cancel the in-flight
// image update, but because the TK renderer is running with [LockOSThread],
// just injecting goroutines willy-nilly results in horrible crashes.
// Supporting async handling would require plumbing channels throughout
// the render handler and making sure the main goroutine is the one that
// exclusively touches the TK API.
//
// [LockOSThread]: https://go.dev/wiki/LockOSThread
func keyPress(e *tk.Event) {
curr := directoryState.i
switch e.Keysym {