Fix log write order error caused by loop queue full when using asynchronous logging system#270
Open
Yuichi1001 wants to merge 1 commit into
Open
Fix log write order error caused by loop queue full when using asynchronous logging system#270Yuichi1001 wants to merge 1 commit into
Yuichi1001 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR描述
修复了使用异步日志系统时由于循环队列已满造成的日志写入顺序错误
理由
假如日志系统使用的是异步模式,写入日志的原代码如下:
此时如果循环队列已满,代码就会执行同步模式的那个分支,直接将现在产生的日志写入日志系统。但是循环队列中仍然有之前还没写入的日志,由此造成了日志写入顺序的错误和日志模式的混乱。
解决方法
为循环队列添加自适应扩容功能,如果循环队列已满,将自动进行扩容。此时原来的日志写入就无须判断
m_log_queue->full()