From b8b4f7771d10e348415a290d905c675a47639a5e Mon Sep 17 00:00:00 2001 From: Learath2 Date: Thu, 19 Oct 2017 18:13:28 +0200 Subject: [PATCH] Rename the callback --- src/engine/engine.h | 2 +- src/engine/shared/engine.cpp | 4 ++-- src/engine/shared/jobs.cpp | 8 ++++---- src/engine/shared/jobs.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/engine/engine.h b/src/engine/engine.h index 6273b1b0a..11a9c3d5d 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -26,7 +26,7 @@ public: virtual void Init() = 0; virtual void InitLogfile() = 0; virtual void HostLookup(CHostLookup *pLookup, const char *pHostname, int Nettype) = 0; - virtual void AddJob(CJob *pJob, JOBFUNC pfnFunc, void *pData, CBFUNC pfnCB = 0) = 0; + virtual void AddJob(CJob *pJob, JOBFUNC pfnFunc, void *pData, CBFUNC pfnDestroy = 0) = 0; }; extern IEngine *CreateEngine(const char *pAppname, bool Silent); diff --git a/src/engine/shared/engine.cpp b/src/engine/shared/engine.cpp index 773088bc9..926fb770c 100644 --- a/src/engine/shared/engine.cpp +++ b/src/engine/shared/engine.cpp @@ -106,11 +106,11 @@ public: AddJob(&pLookup->m_Job, HostLookupThread, pLookup); } - void AddJob(CJob *pJob, JOBFUNC pfnFunc, void *pData, CBFUNC pfnCB = 0) + void AddJob(CJob *pJob, JOBFUNC pfnFunc, void *pData, CBFUNC pfnDestroy = 0) { if(g_Config.m_Debug) dbg_msg("engine", "job added"); - m_JobPool.Add(pJob, pfnFunc, pData, pfnCB); + m_JobPool.Add(pJob, pfnFunc, pData, pfnDestroy); } }; diff --git a/src/engine/shared/jobs.cpp b/src/engine/shared/jobs.cpp index 8c7e635ee..c09402886 100644 --- a/src/engine/shared/jobs.cpp +++ b/src/engine/shared/jobs.cpp @@ -53,8 +53,8 @@ void CJobPool::WorkerThread(void *pUser) pJob->m_Status = CJob::STATE_RUNNING; pJob->m_Result = pJob->m_pfnFunc(pJob->m_pFuncData); pJob->m_Status = CJob::STATE_DONE; - if(pJob->m_pfnCallback) - pJob->m_pfnCallback(pJob, pJob->m_pFuncData); + if(pJob->m_pfnDestroy) + pJob->m_pfnDestroy(pJob, pJob->m_pFuncData); } } @@ -69,12 +69,12 @@ int CJobPool::Init(int NumThreads) return 0; } -int CJobPool::Add(CJob *pJob, JOBFUNC pfnFunc, void *pData, CBFUNC pfnCallback) +int CJobPool::Add(CJob *pJob, JOBFUNC pfnFunc, void *pData, CBFUNC pfnDestroy) { mem_zero(pJob, sizeof(CJob)); pJob->m_pfnFunc = pfnFunc; pJob->m_pFuncData = pData; - pJob->m_pfnCallback = pfnCallback; + pJob->m_pfnDestroy = pfnDestroy; lock_wait(m_Lock); diff --git a/src/engine/shared/jobs.h b/src/engine/shared/jobs.h index edd3c99a4..1dc30bec0 100644 --- a/src/engine/shared/jobs.h +++ b/src/engine/shared/jobs.h @@ -19,7 +19,7 @@ class CJob volatile int m_Result; JOBFUNC m_pfnFunc; - CBFUNC m_pfnCallback; + CBFUNC m_pfnDestroy; void *m_pFuncData; public: CJob() @@ -61,6 +61,6 @@ public: ~CJobPool(); int Init(int NumThreads); - int Add(CJob *pJob, JOBFUNC pfnFunc, void *pData, CBFUNC pfnCallback = 0); + int Add(CJob *pJob, JOBFUNC pfnFunc, void *pData, CBFUNC pfnDestroy = 0); }; #endif