摘要: 一个初级的线程函数 创建10个线程,每个线程内进行计数操作,有锁. 对认识线程,有一定的帮助作用。 #include <iostream> // std::cout #include <thread> // std::thread #include <mutex> // std::mutex usi 阅读全文
posted @ 2022-08-29 22:36 He_LiangLiang 阅读(27) 评论(0) 推荐(0)
摘要: 一个linux程序 网络通信的服务器,监听某个端口号。这里的代码介绍了如何绑定ip地址,如何创建socket,如何设置Ip地址族等 #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sig 阅读全文
posted @ 2022-08-29 22:24 He_LiangLiang 阅读(379) 评论(0) 推荐(0)
摘要: 指针作为参数传递的时候,需要用指针的指针 作为参数 eg: 1 #include <iostream> 2 using namespace std; 3 4 int* p; 5 void func(int** a){ 6 *a = new int(5); 7 } 8 9 int main() 10 阅读全文
posted @ 2022-08-29 22:15 He_LiangLiang 阅读(123) 评论(0) 推荐(0)