3 ms·
> Your functions can look completely synchronous, but yield to the event loop when they invoke a blocking API. This require either runtime-based or operating s
by zozbot234 6y ago
> Your functions can look completely synchronous, but yield to the event loop when they invoke a blocking API.
This require either runtime-based or operating system support. If need be, you can always rely on the OS scheduler to be your "async blocking API".
- jhgb 6y ago> If need be, you can always rely on the OS scheduler to be your "async blocking API". Well, the original red-blue function article did say "just use threads", didn't it?
- slver 6y agoYou need operating system support in the form of async I/O, which every OS offers. No special runtimes, no threads required.
- pas 6y agoThis is becoming more and more true with io_uring, but it was absolutely not the case a few years ago. (Linux AIO was a strange beast. Direct IO was great with preallocated files, but there was no way to do fsync() - especially on file/directory metadata - in an async way. Plus there was a threadpool based glibc thing that somehow faked async I/O, righ?)