/[resiprocate]/main/sip/resiprocate/TimerQueue.cxx
ViewVC logotype

Contents of /main/sip/resiprocate/TimerQueue.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 139 - (show annotations) (download)
Sun Sep 22 18:01:41 2002 UTC (17 years, 4 months ago) by dabryan
File size: 1039 byte(s)
*** empty log message ***

1 #include <sipstack/TimerQueue.hxx>
2 #include <sipstack/TimerMessage.hxx>
3 #include <sipstack/Logger.hxx>
4
5 using namespace Vocal2;
6
7 #define VOCAL_SUBSYSTEM Subsystem::SIP
8
9
10 TimerQueue::TimerQueue(Fifo<Message>& fifo) : mFifo(fifo)
11 {
12 }
13
14 Timer::Id
15 TimerQueue::add(Timer::Type type, const Data& transactionId, unsigned long msOffset)
16 {
17 Timer t(msOffset, type, transactionId);
18 mTimers.insert(t);
19 DebugLog (<< "Adding timer: " << type << " tid=" << transactionId << " ms=" << msOffset);
20
21 return t.getId();
22 }
23
24 void
25 TimerQueue::process()
26 {
27 // get the set of timers that have fired and insert TimerMsg into the fifo
28
29 Timer now(Timer::getTimeMs());
30 for (std::multiset<Timer>::iterator i=mTimers.lower_bound(now);
31 i != mTimers.upper_bound(now); i++)
32 {
33 TimerMessage* t = new TimerMessage(i->mTransactionId, i->mType);
34 DebugLog (<< "Adding timer to fifo: " << " tid=" << i->mTransactionId << " type=" << i->mType);
35 mFifo.add(t);
36 }
37 }
38
39 void
40 TimerQueue::run()
41 {
42 assert(0);
43 // for the thread
44 }
45

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27