语言对比-事件模型
2016-01-03 13:57
239 查看
linux c下可以使用的事件库包括
libevent ,libev ,libuv,glib
git clone https://github.com/MarkTseng/libev
cd libev/
mkdir __INSTALL
chmod 777 *
./autogen.sh
./configure --prefix=/opt/libev/__INSTALL/
make
make install
find __INSTALL/
__INSTALL/
__INSTALL/share
__INSTALL/share/man
__INSTALL/share/man/man3
__INSTALL/share/man/man3/ev.3
__INSTALL/lib
__INSTALL/lib/libev.a
__INSTALL/lib/libev.so.4.0.0
__INSTALL/lib/libev.so.4
__INSTALL/lib/libev.la
__INSTALL/lib/libev.so
__INSTALL/include
__INSTALL/include/event.h
__INSTALL/include/ev.h
__INSTALL/include/ev++.h
demo.c
gcc demo.c -o demo -I./include -L./lib -lev
运行(在__INCLUDE目录下)
cp lib/* /usr/lib
./demo
安装glib
No package 'libffi' found
apt-get install libffi-dev
libevent ,libev ,libuv,glib
libevent
https://github.com/nmathewson/Libeventlibev
案例 shadowsoks-manyusergit clone https://github.com/MarkTseng/libev
cd libev/
mkdir __INSTALL
chmod 777 *
./autogen.sh
./configure --prefix=/opt/libev/__INSTALL/
make
make install
find __INSTALL/
__INSTALL/
__INSTALL/share
__INSTALL/share/man
__INSTALL/share/man/man3
__INSTALL/share/man/man3/ev.3
__INSTALL/lib
__INSTALL/lib/libev.a
__INSTALL/lib/libev.so.4.0.0
__INSTALL/lib/libev.so.4
__INSTALL/lib/libev.la
__INSTALL/lib/libev.so
__INSTALL/include
__INSTALL/include/event.h
__INSTALL/include/ev.h
__INSTALL/include/ev++.h
demo.c
#include <ev.h> #include <stdio.h> ev_io stdin_watcher; ev_timer timeout_watcher; static void stdin_cb(EV_P_ ev_io *w,int revents) { puts ("stdin ready"); ev_io_stop(EV_A_ w); ev_break (EV_A_ EVBREAK_ALL); } static void timeout_cb (EV_P_ ev_timer *w,int revents) { puts ("timeout"); ev_break( EV_A_ EVBREAK_ONE ); } int main(int argc,char* argv[]) { struct ev_loop *loop = EV_DEFAULT; ev_io_init(&stdin_watcher,stdin_cb,0,EV_READ); ev_io_start (loop,&stdin_watcher); ev_timer_init (&timeout_watcher,timeout_cb,5.5,0); // in document the last is 0. not 0,I don't know why yet ev_timer_start (loop,&timeout_watcher); ev_run (loop,0); return 0; }编译(在__INCLUDE目录下)
gcc demo.c -o demo -I./include -L./lib -lev
运行(在__INCLUDE目录下)
cp lib/* /usr/lib
./demo
libuv
git clone https://github.com/libuv/libuv.git安装glib
No package 'libffi' found
apt-get install libffi-dev
glib
bluez5相关文章推荐
- 模式识别学习笔记(四)---聚类算法的技术方案
- 对内存的优化
- 语言对比-线程支持
- Java多线程之生产者消费者2
- MySQL的事务级别测试
- centos的软件安装方法rpm和yum
- dell N5010
- dell N5010
- android图片操作之 Matrix
- Struts2上传文件最大尺寸设置
- 正则表达
- 利用caffe生成 lmdb 格式的文件,并对网络进行FineTuning
- Centos 7网络配置
- 杭电OJ tree(并查集)
- 自定义列表li项目符号
- countUp.js 数字动画
- 搭建jekyll博客
- centos5.5配置网络连接(阿和整理)
- 误操作生成的“病毒“解决方法
- jbpm6.1.0 jbpm-console