From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-12-02 18:43:40


Hi Simon,

Just to clarify...

--- simon meiklejohn <simon_at_[hidden]> wrote:
> Guarantees about how a task will execute may not matter to all
> applications but it critical to others. The asio::demuxer gives
> a guarantee that the task will execute in a thread that has
> called demuxer::run, which may include the thread which is doing
> the requesting - implication being that the call may take place
> immediately.

Immediate execution can only occur if demuxer::dispatch() is used.

> This is an excellent performance optimisation, but
> the programmer may require stronger guarantees, perhaps against
> that very optimisation.

Hence the distinction between demuxer::dispatch() which allows the
optimisation, and demuxer::post() which does not. The decision about
which is appropriate needs to be made at the point where the function
object is invoked, so the two functions are provided.

Cheers,
Chris