This file is indexed.

/usr/include/sipxtapi/os/OsEvent.h is in libsipxtapi-dev 3.3.0~test17-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp.  All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////


#ifndef _OsEvent_h_
#define _OsEvent_h_

// SYSTEM INCLUDES

// APPLICATION INCLUDES
#include "os/OsDefs.h"
#include "os/OsBSem.h"
#include "os/OsNotification.h"
#include "os/OsTime.h"
#include "os/OsMutex.h"

// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS

/**
*  @brief Events are used to synchronize a task with an ISR or between two tasks.
*
*  Events consist of event data (an integer) that is set when the event is
*  signaled and a state variable that indicates whether the event has been
*  signaled. When first initialized, an OsEvent is ready to be signaled.
*  However, once signaled, the OsEvent must be explicitly reset before it
*  may be signaled again. An OsEvent is intended for use in synchronizing
*  one notifier (task or ISR) with one listener task. If an OsEvent object
*  is intended for use with more than one notifier or listener, then an
*  external mutex must be used to serialize access and avoid race 
*  conditions. 
*
*     <h3>Background</h3>
*  First, a little bit of terminology.  The task that wishes to be notified
*  when an event occurs is the "Listener" task. The task that signals when
*  a given event occurs is the "Notifier" task.  A Notifier informs the
*  Listener that a given event has occurred by sending an "Event
*  Notification". 
*
*     <h3>Expected Usage</h3>
*  The Listener passes an event object to the Notifier.  When the
*  corresponding event occurs, the Notifier uses the event object
*  to signal the occurrence of the event. The Listener may receive
*  event notifications by: polling, blocking until the event is
*  signaled, or blocking until either the event is signaled or a
*  timeout expires.  When the Listener receives the event
*  notification, it can then invoke the appropriate event handler.
*  This handler will run in the Listener's task context. 
*
*  @note Using a busy loop to poll for event status is considered
*  anti-social behavior.  However, when using the event object
*  approach, a task can perform a blocking wait for only one event
*  at a time.  A solution that allows a task to receive signals
*  for multiple events is a message queue (see OsQueuedEvent for more
*  information).
*/
class OsEvent : public OsNotification
{

/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:

/* ============================ CREATORS ================================== */

     /// Constructor
   OsEvent(const intptr_t userData=0);

     /// Destructor
   virtual ~OsEvent();

/* ============================ MANIPULATORS ============================== */

     /// Set the event data and signal the occurrence of the event
   virtual OsStatus signal(const intptr_t eventData);
     /**<
     *  Return OS_ALREADY_SIGNALED if the event has already been signaled
     *  (and has not yet been cleared), otherwise return OS_SUCCESS.
     */

     /// Reset the event so that it may be signaled again
   virtual OsStatus reset(void);
     /**<
     *  Return OS_NOT_SIGNALED if the event has not been signaled (or has
     *  already been cleared), otherwise return OS_SUCCESS.
     */

     /// Wait for the event to be signaled
   virtual OsStatus wait(const OsTime& rTimeout=OsTime::OS_INFINITY);
     /**<
     *  Return OS_BUSY if the timeout expired, otherwise return OS_SUCCESS.
     */

     /// Sets the user data specified.  There are situations (such as the OsProtedtedEvent)
   virtual OsStatus setUserData(intptr_t userData);
     /**<
     *  when the user data can not be specified when this object was constructed
     *  so that this method is necessary to set the user data.
     *  Always returns OS_SUCCESS.
     */

/* ============================ ACCESSORS ================================= */

     /// Return the event data that was signaled by the notifier task.
   virtual OsStatus getEventData(intptr_t& rEventData);
     /**<
     *  Return OS_NOT_SIGNALED if the event has not been signaled (or has
     *  already been cleared), otherwise return OS_SUCCESS.
     */

     /// Return the user data specified when this object was constructed.
   virtual OsStatus getUserData(intptr_t& rUserData) const;
     /**<
     *  Always returns OS_SUCCESS.
     */

/* ============================ INQUIRY =================================== */

     /// Return TRUE if the event has been signaled, otherwise FALSE
   virtual UtlBoolean isSignaled(void);

/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:

/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:

   intptr_t  mEventData;   ///< Data set when the event was signaled.
   UtlBoolean mIsSignaled; ///< Indicates whether the event has been signaled.
   OsBSem    mSignalSem;   ///< Semaphore used to queue up tasks waiting for
                           ///<  the event to be signaled.
   OsMutex   mMutex;       ///< Mutex to synchronize access to member variables,
                           ///< especially to mIsSignaled, which may cause
                           ///< deadlock when changed without synchronization.
   intptr_t  mUserData;    ///< Data specified on behalf of the user and
                           ///<  not otherwise used by this class -- the user
                           ///<  data is specified as an argument to the class
                           ///<  constructor.

     /// Copy constructor (not implemented for this class)
   OsEvent(const OsEvent& rOsEvent);

     /// Assignment operator (not implemented for this class)
   OsEvent& operator=(const OsEvent& rhs);

};

/* ============================ INLINE METHODS ============================ */

#endif  // _OsEvent_h_