摘要: template<typename T> class threadsafe_list { struct node // 1 { std::mutex m; std::shared_ptr<T> data; std::unique_ptr<node> next; node(): // 2 next() 阅读全文
posted @ 2024-04-02 17:53 fchy822 阅读(1) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <mutex> #include <condition_variable> #include <thread> template<typename T> class ThreadSafeQueue { private: struct Node 阅读全文
posted @ 2024-04-02 16:18 fchy822 阅读(2) 评论(0) 推荐(0) 编辑
摘要: class ThreadSafeLinkedStack { private: struct Node { T data; std::shared_ptr<Node> next; Node(T data) : data(data), next(nullptr) {} }; std::shared_pt 阅读全文
posted @ 2024-04-02 10:49 fchy822 阅读(2) 评论(0) 推荐(0) 编辑