Reputation: 11661
I currently have a strand that perform jobs for me in a linear order. I wanted to know if there was a way to get the no. of jobs in the queue of the strand.
Upvotes: 3
Views: 224
Reputation: 51941
There is no easy way as strand
neither provides a public means to access the information nor directly contains a count. If you access the private member variables, then it would be possible to obtain the size via count_
within strand::impl_
.
Alternative approaches include:
strand
, providing a similar API that increments and decrements counts. This new type would need to wrap any handlers being posted, as it needs to inject a hook to decrementing the count once the user's handler finishes execution.Upvotes: 2