
c++
Reno_007
座右铭只为成功找方法不为失败找借口
展开
-
使用iocp实现简易的线程池
使用iocp实现简易的线程池1:定义线程池接口2:实现线程锁功能3:线程池的实现3.1:thread_pool_impl.h3.2:thread_pool_impl.cpp3:线程池的使用 1:定义线程池接口 thread_pool.h //线程任务回调 typedef void(*thread_jb_cb)(uint64_t job_id, void* udata); class thread_pool { public: //开启线程池,最大是16,最小是1 virtual bool start(原创 2021-10-19 15:56:55 · 436 阅读 · 0 评论 -
c++ 实现内存池
内存池预先分配一块连续的内存,可以有效减少内存碎片,记录一下 MemoryPool.h #pragma once class MemoryPool { public: static MemoryPool* create(int nCount, int nSize); //创建内存池的大小 static void destory(MemoryPool* pMemoryPool); //销毁内存池 void* allocCache(int nSize); //创建内存 void freeCache原创 2020-12-16 17:15:41 · 335 阅读 · 0 评论