Hello Stephan,

 

I have use stackless coroutines a little bit, and I think, I can explain.

 

> I'm puzzled about the double std::move() of self. In the comments above it says that self is a reference to an intermediate completion handler. How can this be moved twice?

> Can anyone give me hint about what this means?

 

The line

yield delay_timer_->async_wait(std::move(self));

 

terminates the function. If the async operation is complete, the function gets called again and continues at the next statement, but this time with the new, moved self.

 

So the next line

yield boost::asio::async_write(…, …, std::move(self));

 

can move self a 2nd time. When the 2nd async operation completes and execution continues on the next line, the statement

                self.complete(error);

 

finally operates on the 3rd instance of self.

 

I hope this helps,

 

Mario