- 授权协议: Apache-2.0
- 开发语言: C/C++
- 操作系统: 跨平台
- 软件首页: https://github.com/CopernicaMarketingSoftware/REACT-CPP
- 软件文档: https://github.com/CopernicaMarketingSoftware/REACT-CPP/blob/master/README.md
- 官方下载: https://github.com/CopernicaMarketingSoftware/REACT-CPP/releases
软件介绍
REACT-CPP 是利用 C++ 11 的 lambda 表达式在文件描述符或定时器激活的时候进行通知的事件循环库。在它内部实质是对 libev 库的包装,因此也依赖于该库。
在一个典型的应用程序中,你创建了一个 mainloop 类的实例,然后注册你想要查看的 filedescriptors,注册事件处理程序和计时器:
#include <reactcpp.h>
#include <unistd.h>
#include <iostream>
/**
* Main application procedure
* @return int
*/
int main()
{
// create an event loop
React::MainLoop loop;
// set a timer to stop the application after five seconds
loop.onTimeout(5.0, []() {
// report that the timer expired
std::cout << "timer expired" << std::endl;
// stop the application
exit(0);
});
// we'd like to be notified when input is available on stdin
loop.onReadable(STDIN_FILENO, []() -> bool {
// read input
std::string buffer;
std::cin >> buffer;
// show what we read
std::cout << buffer << std::endl;
// return true, so that we also return future read events
return true;
});
// handler when control+c is pressed
loop.onSignal(SIGINT, []() -> bool {
// report that we got a signal
std::cout << "control+c detected" << std::endl;
// stop the application
exit(0);
// although this code is unreachable, we return false because
// we're no longer interested in future SIGINT signals
return false;
});
// run the event loop
loop.run();
// done
return 0;
}
程序员面试宝典(第5版)
欧立奇、刘洋、段韬 / 电子工业出版社 / 2015-10 / 55.00
容提要 《程序员面试宝典(第5版)》是《程序员面试宝典》的第5 版,在保留第4 版的数据结构、面向对象、程序设计等主干的基础上,修正了前4 版近40 处错误,解释清楚一些读者提出的问题,并使用各大IT 公司及相关企业最新面试题(2014-2015)替换和补充原内容,以反映自第4 版以来两年多的时间内所发生的变化。 《程序员面试宝典(第5版)》取材于各大公司面试真题(笔试、口试、电话面试......一起来看看 《程序员面试宝典(第5版)》 这本书的介绍吧!
