display.h

来自「很经典的书籍」· C头文件 代码 · 共 19 行

H
19
字号
//: C11:Display.h
// Prevents ostream collisions
#ifndef DISPLAY_H
#define DISPLAY_H
#include "zthread/Mutex.h"
#include "zthread/Guard.h"
#include <iostream>
#include <sstream>

class Display { // Share one of these among all threads
  ZThread::Mutex iolock;
public:
  void output(std::ostringstream& os) {
    ZThread::Guard<ZThread::Mutex> g(iolock);
    std::cout << os.str();
  }
};
#endif // DISPLAY_H ///:~

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?