C++標準線程庫之共享資源

多線程下難免會需要資源共享,這樣難免會發生異常情況。 #include <iostream> #include <thread> class X { int* _p; public: X(int* p = nullptr) : _p(p) {} ~X() { if(_p) delete _p; } void read() { if(_p
相關文章
相關標籤/搜索