3 ms·
By "wait" I mean logical wait for the result of the async operation - e.g. to use it as an input for another operation - not a blocking thread wait. What you de
by int_19h 6y ago
By "wait" I mean logical wait for the result of the async operation - e.g. to use it as an input for another operation - not a blocking thread wait. What you describe sounds like callbacks to me?
- marcosdumay 6y agoPolling loops are completely different from callbacks. What I described uses functions to read partial or complete results, and functions that indicate if there is any result to read (and yeah, there must be some blocking thing to indicate whether there is any result at all available). It's something much closer to async/await, except that there is something to tell you if await will block. It is much more complex than callbacks, but it enables much higher parallelism and somewhat higher single-thread throughput. Also, runtimes with green threads already have it implemented anyway, because it's the preferred OS (any high performance OS) interface for async.
- int_19h 6y agoAsync/await is just syntactic sugar over callback-based continuations, though. And in .NET at least, you can easily tell if await will block or not, by looking at Task.IsCompleted.