mirror of
https://github.com/armink/EasyLogger.git
synced 2025-01-31 13:32:52 +08:00
提高buf为空时的elog_flush() 性能 (#81)
* 先判断buf中是否有数据,再进行上锁-输出-解锁的操作,避免buf为空时的频繁上/解锁操作
This commit is contained in:
parent
fd21dfe753
commit
e442625088
@ -82,6 +82,8 @@ void elog_buf_output(const char *log, size_t size) {
|
||||
* flush all buffered logs to output device
|
||||
*/
|
||||
void elog_flush(void) {
|
||||
if (buf_write_size == 0)
|
||||
return;
|
||||
/* lock output */
|
||||
elog_output_lock();
|
||||
/* output log */
|
||||
|
Loading…
x
Reference in New Issue
Block a user