Похожие чаты

In ASIO, does an async operation start a new thread

and returns on call to the callback or is it blocked and returns after the callback returns?

9 ответов

8 просмотров

It doesn't start a thread and is not blocking. You send an object that handles connection whenever OS creates it. Your program continues running. https://www.boost.org/doc/libs/1_74_0/doc/html/boost_asio/overview/core/basics.html

Ihor
It doesn't start a thread and is not blocking. You...

How it is possible without thread? How async two different program works?

🖖- Автор вопроса
Ihor
It doesn't start a thread and is not blocking. You...

@JRandomGuy Thanks I really appreciate it

🖖- Автор вопроса
Cengizhan Pasaoglu
How it is possible without thread? How async two d...

Actually, it appears that if you run asio::io_service::run() in the main thread of execution, it blocks until all the operations are done You can decide to call asio::io_service::run() in a different thread

🖖
Actually, it appears that if you run asio::io_serv...

So, I am confused. I want it async without thread, it is not possible in this case because without thread it blocks until all operations done. But with new thread, async operation can be done. Did I understand right?

🖖- Автор вопроса
Cengizhan Pasaoglu
So, I am confused. I want it async without thread,...

No, you need to call asio::io_service::run() to get the result(s) and to pass it/them to the callback

Cengizhan Pasaoglu
So, I am confused. I want it async without thread,...

Async to me is just threads with an abstraction later on top. 🙂

Cengizhan Pasaoglu
So, I am confused. I want it async without thread,...

Me, writing a fiber implementation and a scheduler to solve that problem

Похожие вопросы

Обсуждают сегодня

Вопрос по диагностике ошибок (я знаю в чем, в данном конкретном примере, я знаю, как исправить, пример модельный, понятно, что в реальности бывает намного запутаннее). module...
ⰄⰎⰋⰐⰐⰑⰛⰤⰧⰧⰩⰄ ⰊⰑⰁⰓⰡⰛⰦⰕⰫ
10
Тут кста кто-нибудь NeoVim использует?
Simple Sorcerer
13
А чем вам питонисты не угодили?😂
.
79
Есть какой-нибудь для Delphi/FPC T*Compression(Decompression)Stream на базе LZ4/Zstd/любой другой быстрый(и хорошо сжимающий) алгоритм А ещё лучше в pure pascal А ещё лучше од...
notme
52
New Hedera drama. Is Hashinals on chain or not on chain?
Perfect Ability
16
Can someone explain me the difference of the stated quote on Quants homepage between R3 and Quant? „R3 brings its ability to deliver complex pioneering projects for regulate...
Carlson
2
Asus, норм фирма для ноутов?
Артем Записной
20
guys, why is it taking days for my node to sync? is this normal?
Big Chiano
10
А дальше что?.. Записать в файл, потом в Код?.. И потом разбирать как-то?..
Хаскель Моисеевич Гопник
14
Ребят немного глупый вопрос, но я правильно понимаю что неполнота по геделю означает наличие парадокса?
Smith
9
Карта сайта