sipxportlib  Version 3.3
OsEvent.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 
12 #ifndef _OsEvent_h_
13 #define _OsEvent_h_
14 
15 // SYSTEM INCLUDES
16 
17 // APPLICATION INCLUDES
18 #include "os/OsDefs.h"
19 #include "os/OsBSem.h"
20 #include "os/OsNotification.h"
21 #include "os/OsTime.h"
22 #include "os/OsMutex.h"
23 
24 // DEFINES
25 // MACROS
26 // EXTERNAL FUNCTIONS
27 // EXTERNAL VARIABLES
28 // CONSTANTS
29 // STRUCTS
30 // TYPEDEFS
31 // FORWARD DECLARATIONS
32 
70 class OsEvent : public OsNotification
71 {
72 
73 /* //////////////////////////// PUBLIC //////////////////////////////////// */
74 public:
75 
76 /* ============================ CREATORS ================================== */
77 
79  OsEvent(const intptr_t userData=0);
80 
82  virtual ~OsEvent();
83 
84 /* ============================ MANIPULATORS ============================== */
85 
87  virtual OsStatus signal(const intptr_t eventData);
93  virtual OsStatus reset(void);
100  virtual OsStatus wait(const OsTime& rTimeout=OsTime::OS_INFINITY);
106  virtual OsStatus setUserData(intptr_t userData);
114 /* ============================ ACCESSORS ================================= */
115 
117  virtual OsStatus getEventData(intptr_t& rEventData);
123  virtual OsStatus getUserData(intptr_t& rUserData) const;
129 /* ============================ INQUIRY =================================== */
130 
132  virtual UtlBoolean isSignaled(void);
133 
134 /* //////////////////////////// PROTECTED ///////////////////////////////// */
135 protected:
136 
137 /* //////////////////////////// PRIVATE /////////////////////////////////// */
138 private:
139 
140  intptr_t mEventData;
141  UtlBoolean mIsSignaled;
142  OsBSem mSignalSem;
143  OsMutex mMutex;
145  intptr_t mUserData;
148 
153  OsEvent(const OsEvent& rOsEvent);
154 
156  OsEvent& operator=(const OsEvent& rhs);
157 
158 };
159 
160 /* ============================ INLINE METHODS ============================ */
161 
162 #endif // _OsEvent_h_
163 
virtual OsStatus wait(const OsTime &rTimeout=OsTime::OS_INFINITY)
Wait for the event to be signaled.
Definition: OsEvent.cpp:110
OsEvent(const intptr_t userData=0)
Constructor.
Definition: OsEvent.cpp:38
Definition: OsNotification.h:35
OsStatus
Definition: OsStatus.h:27
virtual OsStatus setUserData(intptr_t userData)
Sets the user data specified. There are situations (such as the OsProtedtedEvent) ...
Definition: OsEvent.cpp:115
virtual OsStatus getUserData(intptr_t &rUserData) const
Return the user data specified when this object was constructed.
Definition: OsEvent.cpp:143
Definition: OsTime.h:45
virtual OsStatus getEventData(intptr_t &rEventData)
Return the event data that was signaled by the notifier task.
Definition: OsEvent.cpp:126
Events are used to synchronize a task with an ISR or between two tasks.
Definition: OsEvent.h:70
Definition: OsTime.h:37
int UtlBoolean
Definition: UtlDefs.h:41
virtual UtlBoolean isSignaled(void)
Return TRUE if the event has been signaled, otherwise FALSE.
Definition: OsEvent.cpp:152
virtual OsStatus signal(const intptr_t eventData)
Set the event data and signal the occurrence of the event.
Definition: OsEvent.cpp:61
virtual OsStatus reset(void)
Reset the event so that it may be signaled again.
Definition: OsEvent.cpp:86
_W64 signed int intptr_t
Definition: stdint.h:118
virtual ~OsEvent()
Destructor.
Definition: OsEvent.cpp:49