blob: abd93721818d3df1547faa2a28eb224ab6776d14 (
plain)
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
|
#include "ace/Log_Msg.h"
#include "PCB.h"
#include "PTimerDispatcher.h"
PCB::PCB() : count_(0)
{
ACE_TRACE ("PCB::PCB");
}
PCB::~PCB()
{
}
int PCB::handleEvent (const void *arg)
{
ACE_TRACE ("PCB::handleEvent");
const int *val = static_cast<const int*> (arg);
ACE_ASSERT ((*val) == timerID_);
ACE_UNUSED_ARG (val);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("Timer %d expiry handled by thread %t\n"),
timerID_));
if (count_ == 5)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Reseting interval for timer %d\n"),
timerID_));
// New interval is 10 ms.
ACE_Time_Value interval (0L, 1000L);
if (PTimer::instance ()->reset_interval (timerID_, interval) != -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("reset_interval")),
-1);
}
if (count_++ == 10)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Canceling %d\n"),
timerID_));
PTimer::instance ()->cancel (this);
}
return 0;
}
void
PCB::setID (long timerID)
{
ACE_TRACE ("PCB::setID");
timerID_ = timerID;
}
long
PCB::getID () const
{
ACE_TRACE ("PCB::getID");
return timerID_;
}
int
PCB::handleClose ()
{
ACE_TRACE ("PCB::handleClose");
return 0;
}
int
PCB::handleCancel ()
{
ACE_TRACE ("PCB::handleCancel");
return 0;
}
|