Boost logo

Boost Users :

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

>> I am new to boost and asio in particular. For now I am implementing a
>> simple UDP sender.
>> >
>> > The sending process itself works fine but for some reason the send
>> handler does not execute.
>> Most likely, io_service::run() isn't running.
> I see - yes, this is very likely indeed. In that context more questions:
> Simply calling run in my case doesn't help: sj->dFC->;
> So I saw a number of examples, in which an extra thread is created via:
> boost::thread t = boost::thread (boost::bind(&boost::asio::io_service::run, &sj->dFC->io_service));
> t.join();
> This didn't change anything either.
> Is it correct to create an explicit thread ? If so does my base-class (which contains the async_functions) have to inherit this thread in order to make it work ? At the moment I simply create it within the class.

You can create an explicit thread an invoke io_service::run() there,
as you've shown above. No need to inherit thread,
boost::thread/std::thread object accepts the thread procedure as a
In general, it's quite hard to tell what the problem is without seeing
your code. If you can't make a small self-contained sample that
reproduces the issue, try posting your real code.

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