|
|
1.1 root 1: //
2: // nono
1.1.1.3 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #pragma once
8:
9: #include "fixedqueue.h"
10: #include <mutex>
11:
12: // ログキュー
13: class Logger
14: {
15: public:
16: Logger();
17: virtual ~Logger();
18:
19: // ログ書き込み
20: void Write(const char *);
21:
22: // ログ読み出し
23: bool Read(char *, int);
24:
25: // 標準出力にも出すかどうか
26: void UseStdout(bool val) { use_stdout = val; }
27:
28: private:
29: // パイプ
30: FixedQueue<uint8, 65536> pipe {};
31:
32: // 1行ずつの読み書き動作をアトミックにするための排他制御
33: std::mutex mtx {};
34:
35: // 標準出力にも出すかどうか
1.1.1.4 ! root 36: bool use_stdout {};
1.1 root 37: };
38:
1.1.1.3 root 39: extern Logger gLogger;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.