在Boost.Log中正确使用asynchronous_sink::flush()

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

本文关键字:sink flush asynchronous Log Boost      更新时间:2023-10-16

根据Boost.Log文档(见本页末尾),asynchronous_sinkflush()方法需要

sink前端必须在不生成专用的情况下构造线程。

这个要求对我来说没有意义。此外,在整个Boost.Log文档(例如,请参阅这里和这里)的示例代码中也不满足此要求。那么,究竟如何正确使用flush()法呢?

前提条件不正确。当有一个专用的记录提供线程时,您可以使用flush