-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTimeWheel.cpp
More file actions
55 lines (40 loc) · 959 Bytes
/
TimeWheel.cpp
File metadata and controls
55 lines (40 loc) · 959 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
42
43
44
45
46
47
48
49
50
51
52
53
54
// TimeWheel.cpp : 定义控制台应用程序的入口点。
//
#include "TimeWheelLink.h"
bool g_IsClear = false;
//对象指针
class CEntey
{
public:
CEntey()
{
};
~CEntey()
{
}
};
void TimeWheel_Timeout_Callback(vector<CEntey*> vecEntey)
{
for (int i = 0; i < (int)vecEntey.size(); i++)
{
OUR_DEBUG((LM_INFO, "[TimeWheel_Timeout_Callback](%016x) is clear.\n", vecEntey[i]));
g_IsClear = true;
}
}
int ACE_TMAIN(int argc, ACE_TCHAR* argv[])
{
CTimeWheelLink<CEntey> objTimeWheelLink;
objTimeWheelLink.Init(3, 1, 2, TimeWheel_Timeout_Callback);
CEntey objEntey1;
CEntey objEntey2;
objTimeWheelLink.Add_TimeWheel_Entey(&objEntey1);
objTimeWheelLink.Add_TimeWheel_Entey(&objEntey2);
ACE_Time_Value ttSleep(1, 0);
while (true)
{
ACE_OS::sleep(ttSleep);
objTimeWheelLink.Add_TimeWheel_Entey(&objEntey1);
objTimeWheelLink.Tick();
}
return 0;
}