关于信号和槽有一个非常精炼的C++实现,作者是Sarah Thompson,该实现只有一个头文件sigslot.h,跨平台且线程安全。
源码在:CVS Info for project sigslot
在WebRTC中,sigslot .h是其基础的事件处理框架, 在多个模块的消息通知,响应处理中被使用。
sigslot.h的使用方法如下所示:
#include "sigslot.h"
#include <string>
#include <stdio.h>
#include <iostream>
#include <windows.h>
using namespace sigslot;
using namespace std;
class CSender
{
public:
sigslot::signal2<string, int> m_pfnsigDanger;
void Panic()