![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
工作总结
文章平均质量分 82
铲灰
平凡的一个人
展开
-
业务类处理自定义消息
#ifndef _MSG_QUE_H__ #define _MSG_QUE_H__ #include <queue> #include <list> #include <assert.h> #include <mutex> #include <condition_variable> ///C++11中没有信号量操作,用条件变量模拟信号量 class semaphore { public: semaphore(long count = 0...原创 2021-04-10 18:13:08 · 111 阅读 · 0 评论 -
C++观察者模式
#include <iostream> #include <vector> #include <algorithm> using namespace std; ///加深点印象 ///定义了事件类型 ///业务类可以根据事件类型来判断那条消息需要处理, 不需要的消息就过滤掉 ///业务类只有一个收到消息的入口就是OnEvent函数,如果使用单例模式的话,以后开出接口的机会一定会越来越多 typedef enum Event { event1 = 1, ...原创 2021-04-02 16:54:13 · 176 阅读 · 0 评论