28 lines
402 B
C++
28 lines
402 B
C++
#ifndef LOG_QUEUE_H
|
|
#define LOG_QUEUE_H
|
|
|
|
#include <queue>
|
|
#include <thread>
|
|
#include <mutex>
|
|
#include <condition_variable>
|
|
|
|
class log_queue
|
|
{
|
|
private:
|
|
std::thread _worker;
|
|
std::mutex _mutex;
|
|
std::condition_variable _cond;
|
|
std::queue<std::string> _queue;
|
|
|
|
private:
|
|
void worker_func();
|
|
|
|
public:
|
|
log_queue();
|
|
~log_queue();
|
|
void add_log(const std::string& logLine);
|
|
};
|
|
|
|
#endif /* LOG_QUEUE_H */
|
|
|