11 2018 档案
摘要:1.01 高 DPI 缩放 在 main() 函数开头调用 // 确保应用在高分辨率屏幕上显示清晰。 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_UseHighD
阅读全文
摘要:// 1. 同步定时器 #include <cstdio> #include <iostream> #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> int main() { boost::a
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <pthread.h> #include <arpa/inet.h> #include <liburing.h> #defi
阅读全文
摘要:# 安装 liburing 开发库 sudo apt-get install liburing-dev # 或从源码编译安装:https://github.com/axboe/liburing io_uring 是 Linux 内核提供的一套 异步 I/O 框架,它通过 共享内存环形队列(ring
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <sys/epoll.h> #include <netinet/in.h>
阅读全文
摘要:epoll 是 Linux 内核为处理大批量文件描述符而作了改进的 poll,是 Linux 下多路复用 IO接口 select/poll 的增强版本. 在 linux 的网络编程中,很长时间都在使用 select 来做事件触发。在 2.6 内核中,有一种替换它的机制,就是 epoll。 selec
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h>
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h>
阅读全文
摘要:阻塞: 阻塞调用是指调用结果返回之前,当前线程会被挂起(线程进入非可执行状态,在这个状态下,cpu不会给线程分配时间片,即线程暂停运行)。 函数只有在得到结果之后才会返回。 非阻塞: 非阻塞和阻塞的概念相对应,指在不能立刻得到结果之前,该函数不会阻塞当前线程,而会立刻返回。 /** 参 数 :int
阅读全文
摘要:下载库:http://sourceforge.net/projects/jsoncpp/files/ tar -zxvf jsoncpp-src-0.5.0 -C jsoncpp (1) 安装 scons $ sudo apt-get install scons (2) 切换到 jsoncpp 目录
阅读全文
摘要:定义业务类,继承 Thread类,实现run函数。可跨平台,调用start()即可 #pragma once #include <thread> #include <atomic> #include <functional> class Thread { private: std::thread _
阅读全文
浙公网安备 33010602011771号