add a comment about async code and TK
This commit is contained in:
10
main.go
10
main.go
@@ -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) {
|
func keyPress(e *tk.Event) {
|
||||||
curr := directoryState.i
|
curr := directoryState.i
|
||||||
switch e.Keysym {
|
switch e.Keysym {
|
||||||
|
Reference in New Issue
Block a user