Boost logo

Boost Users :

Subject: Re: [Boost-users] async_send handler problem
From: Igor R (boost.lists_at_[hidden])
Date: 2013-12-16 14:53:51

> Yes, I truly understand this but for some weired reason this doesn't work
> at all. In my case I launch the run function in the constructor of the
> main class right after the sender class had been instantiated:
> SJ::SJ(){
> dFC->mySender = new sender(this);
> boost::thread t =
> boost::thread(boost::bind(&boost::asio::io_service::run,
> &dFC->io_service));
> t.join();
> // OR dFC->;
> }
> In there anything wrong with this ?

It seems that you call io_serivce::run() before any async operation
was issued. In such a case, run() just exits immediately, as I
explained in one of my previous comments. In order to avoid such a
associate io_service::work object with this io_service:
(scroll down)

In general, it's highly recommended to read the Asio documentation -
all these issues are described there.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at