forked from firstblade/TTWinClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpPoolModule_Impl.h
More file actions
87 lines (75 loc) · 2 KB
/
HttpPoolModule_Impl.h
File metadata and controls
87 lines (75 loc) · 2 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*******************************************************************************
* @file HttpPoolModule_Impl.h 2014\7\25 11:20:55 $
* @author 快刀<kuaidao@mogujie.com>
* @brief
******************************************************************************/
#ifndef HTTPPOOLMODULE_IMPL_43FDB575_36B4_4CFC_B205_89A9D1904A4C_H__
#define HTTPPOOLMODULE_IMPL_43FDB575_36B4_4CFC_B205_89A9D1904A4C_H__
#include "Modules/IHttpPoolModule.h"
#include "utility/TTThread.h"
#include "utility/TTAutoLock.h"
#include <vector>
#include <list>
/******************************************************************************/
using namespace util;
class TTHttpThread;
/**
* The class <code>HttpPoolModule_Impl</code>
*
*/
class HttpPoolModule_Impl final : public module::IHttpPoolModule
{
friend class TTHttpThread;
public:
/** @name Constructors and Destructor*/
//@{
/**
* Constructor
*/
HttpPoolModule_Impl();
/**
* Destructor
*/
virtual ~HttpPoolModule_Impl();
//@}
virtual void release();
public:
virtual void pushHttpOperation(module::IHttpOperation* pOperaion, BOOL bHighPriority = FALSE);
virtual void shutdown();
private:
/**
* 加载线程
*
* @param
* @return TRUE : success FALSE : fail
* @exception there is no any exception to throw.
*/
virtual BOOL _launchThread();
/**
* 取消所有任务
*
* @param
* @return
* @exception there is no any exception to throw.
*/
virtual void _cancelAllOperations();
private:
TTFastLock m_mtxLock;
std::list<module::IHttpOperation*> m_lstHttpOpers;
std::vector<TTHttpThread*> m_vecHttpThread;
HANDLE m_hSemaphore;
};
class TTHttpThread : public util::TTThread
{
friend class HttpPoolModule_Impl;
public:
TTHttpThread();
void shutdown();
DECLARE_SAFE_RELEASE()
private:
virtual UInt32 process();
private:
BOOL m_bContinue;
};
/******************************************************************************/
#endif// HTTPPOOLMODULE_IMPL_43fdb575-36b4-4cfc-b205-89a9d1904a4c_H__