开发者

boost::io_service api implementation seems missing?

I'm running boost 1.43.0 release, and I see the following api (in 开发者_高级运维asio::io_service class):

For measuring performance, return the number of outstanding work items in the queue.

  int get_outstanding_work();
  int get_ready_work();

I don't find any web documentation for this.Though I see their implementation in io_service.ipp, but there is no actual implementation. I want to use it for knowing how many handlers are pending?


I am not sure this behavior is available for the io_service class.

Workaround: Instead of directly passing your handlers, you might want to create a wrapper functor around your handlers, and pass that to the io_service. Said wrapper would keep a reference to a size_t variable and increment that on constructor, and decrement that on the () operator.

After that, just look at the size_t variable to check how many handlers are left in io_service's queue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜