0
votes

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?

1
What do you mean, there is no implementation? - Armen Tsirunyan

1 Answers

1
votes

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.