engstrand-config/dwl-guile

Use Guile Futures for executing user actions

Closed this issue · 1 comments

Guile Futures allows us to evaluate expressions in a threaded environment without the large overhead cost of spawning threads. This would prevent any issues with user actions blocking the main thread of dwl-guile, removing the need for something like eval-async.

I did some experimenting with this and realised that it is not quite this simple. Calling dwl-guile bindings from futures can cause really weird behaviour because of it not being executed in the main thread. If this binding does something that affects the rendering in dwl, the result can be UB.

Commit 5d9211c prevents thread safety issues in eval-async, and also renames it dwl:run-async for consistency. However, the solution is nowhere near fast enough to be used for all user bindings, and the extra overhead is not at all worth it.