Closed JaydenFish closed 2 years ago
如果设置了FMTLOG_BLOCK则log writer会等到入队列成功才返回,如果没有其他线程poll的话确实会死循环。所以单线程程序不应该设置FMTLOG_BLOCK,这样队列满了直接丢弃并返回。
Please correct me if I'm wrong, but it seems that the OP is correct. If header
is not a null pointer, then data is formatted using this header and after header->push(alloc_size)
is called, the loop continues until the queue is full and then it starts looping via continue
.
do {
auto header = threadBuffer->varq.allocMsg(alloc_size);
if (!header) continue;
header->logId = logId;
char* out = (char*)(header + 1);
// ...
encodeArgs<0>(cstringSizes, out, std::forward<Args>(args)...);
header->push(alloc_size);
} while (1);
Am I missing something?
Sorry, I made a mistake in previous revision, fixed now. Thanks for notifying me.
里面只有continue,没有break和return. 死循环吧? 我一运行程序就卡住了.