摘要: 线程池的作用 在多线程的应用中,线程的频繁创建和销毁会浪费时间,从而影响效率,所以引进线程池和概念,将多个线程维护在线程池中,避免了线程频繁创建与销毁的开销问题 线程池的结构 结构体 struct threadpool_t { pthread_mutex_t lock; //互斥锁 pthread_ 阅读全文
posted @ 2021-07-16 21:28 bytepro 阅读(36) 评论(0) 推荐(0)
摘要: 读写锁 特点 相关操作函数 #include <pthread.h> pthread_rwlock_t rwlock; //初始化读写锁 int pthread_rwlock_init(pthread_rwlock_t *restrict rwlock, const pthread_rwlockat 阅读全文
posted @ 2021-07-16 21:27 bytepro 阅读(36) 评论(0) 推荐(0)