Search code examples
c++boostboost-log

Properly use asynchronous_sink::flush() in Boost.Log


According to the Boost.Log documentation (see the end of this page), the flush() method of asynchronous_sink requires

The sink frontend must be constructed without spawning a dedicated thread.

This requirement makes no sense to me. Furthermore, it is not met in example code throughout the Boost.Log documentation (e.g., see here and here). So, how to properly use the flush() method exactly?


Solution

  • The precondition is incorrect. You can use flush when there is a dedicated record feeding thread.