sipxportlib  Version 3.3
OsTimerTask.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006-2013 SIPez LLC. All rights reserved.
3 //
4 // Copyright (C) 2004-2006 SIPfoundry Inc.
5 // Licensed by SIPfoundry under the LGPL license.
6 //
7 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
8 // Licensed to SIPfoundry under a Contributor Agreement.
9 //
10 // $$
12 
13 
14 #ifndef _OsTimerTask_h_
15 #define _OsTimerTask_h_
16 
17 // SYSTEM INCLUDES
18 
19 // APPLICATION INCLUDES
20 #include "os/OsDefs.h"
21 #include "os/OsBSem.h"
22 #include "os/OsMsgQ.h"
23 #include "os/OsServerTask.h"
24 
25 // DEFINES
26 // MACROS
27 // EXTERNAL FUNCTIONS
28 // EXTERNAL VARIABLES
29 // CONSTANTS
30 // STRUCTS
31 // TYPEDEFS
32 
33 // FORWARD DECLARATIONS
34 class OsTimer;
35 class OsTimerMsg;
36 
37 //:Timer service request manager (runs as a separate task)
38 // This task is responsible for managing timer service requests. Timer
39 // requests are received via a message queue.
40 
41 class OsTimerTask : public OsServerTask
42 {
43 /* //////////////////////////// PUBLIC //////////////////////////////////// */
44 public:
45 
46 /* ============================ CREATORS ================================== */
47 
48  static OsTimerTask* getTimerTask(void);
49  //:Return a pointer to the timer task, creating it if necessary
50 
51  static void destroyTimerTask(void);
52  //: Destroy the singleton instance of the sys timer
53  // Should only be called when timers are not being started or stopped.
54  // All current timers are stopped.
55 
56  virtual
57  ~OsTimerTask();
58  //:Destructor
59  // Should not be called directly. Use destroyTimerTask().
60 
61 /* ============================ MANIPULATORS ============================== */
62 
63 /* ============================ ACCESSORS ================================= */
64 
65 /* ============================ INQUIRY =================================== */
66 
67 /* //////////////////////////// PROTECTED ///////////////////////////////// */
68 protected:
69 
71  OsTimerTask();
77 /* //////////////////////////// PRIVATE /////////////////////////////////// */
78 private:
79  static const int TIMER_MAX_REQUEST_MSGS; // Maximum number of request messages
80 
82  virtual int run(void* pArg);
87  virtual UtlBoolean handleMessage(OsMsg& rMsg);
90 
98  virtual void fireTimer(OsTimer* timer);
99 
101  static volatile OsTimerTask* spInstance;
103 
105  static OsBSem *sLock;
106 
108  OsTimer* mTimerQueue;
109 
111  OsTime mSignalTimeout;
112 
114  void insertTimer(OsTimer* timer);
115 
117  void removeTimer(OsTimer* timer);
118 
120  OsTimerTask(const OsTimerTask& rOsTimerTask);
121 
123  OsTimerTask& operator=(const OsTimerTask& rhs);
124 
125 };
126 
127 /* ============================ INLINE METHODS ============================ */
128 
129 #endif // _OsTimerTask_h_
Definition: OsServerTask.h:34
Definition: OsTimerTask.h:41
static OsTimerTask * getTimerTask(void)
Definition: OsTimerTask.cpp:43
OsTimerTask()
Constructor (called only indirectly via getTimerTask())
Definition: OsTimerTask.cpp:114
static void destroyTimerTask(void)
Definition: OsTimerTask.cpp:73
Definition: OsTime.h:37
virtual ~OsTimerTask()
Definition: OsTimerTask.cpp:87
Definition: OsTimer.h:105
int UtlBoolean
Definition: UtlDefs.h:41
Definition: OsMsg.h:36
Definition: OsTimerMsg.h:37