When working with
actors, one of the axioms is that you never block a task for longer -- otherwise it will not have a chance to let the other tasks run.
So far so good, but: Does that also hold for detached tasks? I'm writing an
actor that is supposed to control hardware. Unfortunately though, it has only a synchronous interface to its read and write operations. I want to hide this interface behind the asynchronous
actor, hence planned to use
withCheckedContinuation, spawn a detached task, call the blocking operation and then resume the continuation.
Is this going to work? Is it a good design or will this spawn and shutdown threads all the time? Is there a better alternative?