akernel
akernel copied to clipboard
Support running user code in a thread
This PR makes it possible to run user code in a thread, i.e. a different thread than the thread where the kernel protocol is handled. It's especially useful for fps-akernel-task, which can be run in-process. By default user code is not run in a thread, and so it could block the host (and its event loop), but not if it is run in a thread. Thus it is possible to have an in-process kernel that doesn't block the host. Because of the GIL it won't scale as a subprocess kernel, but I think that with free-threading that limitation won't even hold. User code is clearly separate from the kernel protocol logic, so there should not be any issue with free-threading.