|
新的线程池多了一个
线程池监听器接口 IHPThreadPoolListener,监听线程池生命周期事件
HPSocket.h
// IHPThreadPool 对象创建器
struct HPThreadPool_Creator
{
static IHPThreadPool* Create(IHPThreadPoolListener* pListener = nullptr)
{
return HP_Create_ThreadPool(pListener);
}
static void Destroy(IHPThreadPool* pThreadPool)
{
HP_Destroy_ThreadPool(pThreadPool);
}
};
// IHPThreadPool 对象智能指针
typedef CHPObjectPtr<IHPThreadPool, IHPThreadPoolListener, HPThreadPool_Creator> CHPThreadPoolPtr;
VOL_HPSocket.h 以下内容我需要如何修改支持
// HP线程池类
class CHPSocketThreadPoolWraper
{
private:
IHPThreadPool* data;
public:
inline_ CHPSocketThreadPoolWraper()
{
data = HP_Create_ThreadPool();
}
inline_ IHPThreadPool* GetData()
{
return data;
}
inline_ void Close()
{
if (data != NULL)
{
if (data->HasStarted()) data->Stop();
HP_Destroy_ThreadPool(data);
data = NULL;
}
}
inline_ ~CHPSocketThreadPoolWraper()
{
Close();
}
};
请教各位前辈,或者谁升级了 hp-socket-5.9.1 能否提供一份,感激不尽
|
|