r/cpp • • Sep 15 '26

Asynchronous API

https://grishavanika.github.io/async_api.html
36 Upvotes

28 comments sorted by

View all comments

Show parent comment

3

u/grishavanika Sep 17 '26

How can I understand where and when code is executed?

The code in the article is intentioinally one self-contained main.cc file for every section, with nothing more then calls to a CURL library. It should be trivial to put breakpoints to see how it executes. So bunch of the code is executed in CURL internals which we call inside CURL_AsyncScheduler::tick(), which is called in a loop from within a main.

For callbacks, the section is implementing with libcurl multi which also links to main.cc.

This async style is intentionally trying to hide things behind abstractions to help people write more of it

It is, but the article builds everything from scratch to be able to step thru all of the abstractions - intentionally, so there is a way to see all of the layers. (Well, maybe CURL API hides the system specific calls, but it's close to what needs to be done using system API).

What ways are there to make some requests high priority, normal priority, or low priority? Not only at the CPU level but at the I/O level.

I don't have good answer since most of the time I used only IOCP.