File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313
1414---
1515
16- ## ⭐️ Getting Started
16+ ## Getting Started
1717
1818``` cpp
1919#include " include/logger.hpp"
@@ -43,7 +43,7 @@ Just add `include/` to your project. No dependencies outside C++17 STL and bundl
4343
4444## Issues and Contributing
4545- Please [ open an Issue] ( https://github.com/mbn-code/cLog/issues ) for bugs, features, or questions!
46- - Star the repo if you find it useful ⭐
46+ - Star the repo if you find it useful
4747- [ Contributing Guide] ( CONTRIBUTING.md )
4848
4949---
Original file line number Diff line number Diff line change @@ -121,22 +121,27 @@ class Logger {
121121 worker_ = std::thread ([this ] { run_async (); });
122122 }
123123 void run_async () {
124- for (;; ) {
124+ while ( true ) {
125125 Entry entry;
126126 {
127127 std::unique_lock<std::mutex> lk (mutex_);
128128 cv_.wait (lk, [&] { return stop_ || !queue_.empty (); });
129129 if (queue_.empty ()) {
130- if (stop_) break ;
131- else continue ;
130+ if (stop_) {
131+ break ;
132+ } else {
133+ continue ;
134+ }
132135 }
133136 entry = std::move (queue_.front ());
134137 queue_.pop ();
135138 }
136139 emit_entry (entry);
137140 // After emitting, if stop_ and queue is empty, exit
138141 std::unique_lock<std::mutex> lk (mutex_);
139- if (stop_ && queue_.empty ()) break ;
142+ if (stop_ && queue_.empty ()) {
143+ break ;
144+ }
140145 }
141146}
142147};
You can’t perform that action at this time.
0 commit comments