-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxx_threadpool.cpp
More file actions
41 lines (31 loc) · 867 Bytes
/
xx_threadpool.cpp
File metadata and controls
41 lines (31 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#if _MSC_VER && !__INTEL_COMPILER
#include "xx_threadpool_win.cpp"
#else
#include "xx_threadpool_unix.cpp"
#endif
CXXWorkQueue* XX_Thread_CreateWorkQueue(int iMaxThreadNum) {
CXXWorkQueue* pWorkQueue = new CXXWorkQueue();
pWorkQueue->Create(iMaxThreadNum);
return pWorkQueue;
}
int XX_Thread_InsertWorkItem(const CXXWorkQueue* pWorkQueue, CXXThreadWorker* pWorker) {
if (pWorkQueue == NULL)
return -1;
if (pWorker == NULL)
return -1;
return ((CXXWorkQueue*)pWorkQueue)->InsertWorkItem(pWorker);
}
void XX_Thread_Destory(CXXWorkQueue* pWorkQueue, int iWaitInterval) {
if (pWorkQueue == NULL)
return;
pWorkQueue->Destory(iWaitInterval);
delete pWorkQueue;
pWorkQueue = NULL;
}
void XX_Thread_DestoryForce(CXXWorkQueue* pWorkQueue) {
if (pWorkQueue == NULL)
return;
pWorkQueue->DestoryForce();
delete pWorkQueue;
pWorkQueue = NULL;
}