Hello all,

We are facing some issues with boost::asio::executor_work_guard.

We are spawning some threads which are bound to a boost::asio::io_context and 
proteced by a boost::asio::executor_work_guard so that they do not exit even if 
there is no work to be done.
However, despite the work_guard still being valid, we see that the threads exit 
because boost::asio::detail::scheduler::outstanding_work reaches 0.

All operations added to the queue are posted asynchronously.

The boost version in use is 1.75 (also tested with 1.78 and the behaviour is 
the same).

Could you help us on the following topics so that we can understand what the 
root cause may be?

1 - We created an implementation to track the number of elements on 
boost::asio::detail::op_queue, is this implementation valid?

uint32_t size() {
      auto tmp_op = front_;
      uint32_t size{0};
      while (tmp_op != 0) {
            ++size;
            tmp_op = op_queue_access::next(tmp_op);
      }
      return size;
}

2 - Assuming the approach above is correct, we are trying to compare the values 
of outstanding_work with the returned value of op_queue.size(). However, these 
values do not seem to correlate, is this to be expected?

3 - Was this issue observed by someone else? If so what were the root causes?

Thanks!

Kind Regards,
João Silva
The information in this communication may contain confidential or legally 
privileged information. It is intended solely for the use of the individual or 
entity it addresses and others authorized to receive it. If you are not an 
intended recipient, you are hereby notified that any disclosure, copying, 
distribution or action in reliance on the contents of this information is 
strictly prohibited and may be unlawful. If you have received this 
communication by error, please notify us immediately by responding to this 
e-mail and then delete it from your system. Critical TechWorks is not liable 
for the proper and complete transmission of the information in this 
communication nor for any delay in its receipt

This e-mail is environmentally friendly, just like Critical TechWorks, which 
lives in a paper-free atmosphere. Therefore, please consider the environment 
before printing it!
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users

Reply via email to