摘要: blockingqueue和boundedblockingqueue 作用: 无边界blockingqueue: 实现了一个有锁的dequeue双端队列保证put,take,size操作都具有原子性内部使用互斥锁mutexlock,再使用一个条件变量用于判断队列是否为空 有边界boundedbloc 阅读全文
posted @ 2020-08-26 17:56 WoodInEast 阅读(247) 评论(0) 推荐(0)
摘要: threadpool类: class threadpool:noncopyable { }; 作用: 利用mymuduo::thread 完成对于线程池的封装线程池内部成员:线程集合m_threads: 用于保存线程池内的所有线程线程池任务队列m_queue 表示待执行的任务队列条件变量:m_not 阅读全文
posted @ 2020-08-26 16:36 WoodInEast 阅读(269) 评论(0) 推荐(0)
摘要: thread类: //namespace mymuduo class thread { }; //namespace mymuduo::detail struct ThreadData { }; 作用: 两个重要的类mymuduo::thread和mymuduo::detail::ThreadDat 阅读全文
posted @ 2020-08-26 02:14 WoodInEast 阅读(363) 评论(0) 推荐(0)