This file is indexed.

/usr/include/IceE/Monitor.h is in libicee-dev 1.2.0-6.1ubuntu1.

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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
// **********************************************************************
//
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
//
// This copy of Ice-E is licensed to you under the terms described in the
// ICEE_LICENSE file included in this distribution.
//
// **********************************************************************

#ifndef ICEE_MONITOR_H
#define ICEE_MONITOR_H

#include <IceE/Config.h>
#include <IceE/Lock.h>
#include <IceE/Cond.h>

namespace IceUtil
{

//
// This monitor implements the Mesa monitor semantics. That is any
// calls to notify() or notifyAll() are delayed until the monitor is
// unlocked.
//
template <class T>
class Monitor
{
public:

    typedef LockT<Monitor<T> > Lock;
    typedef TryLockT<Monitor<T> > TryLock;

    Monitor();
    ~Monitor();

    //
    // Note that lock/tryLock & unlock in general should not be used
    // directly. Instead use Lock & TryLock.
    //
    void lock() const;
    void unlock() const;
    bool tryLock() const;

    void wait() const;
    bool timedWait(const Time&) const;
    void notify();
    void notifyAll();

private:

    // noncopyable
    Monitor(const Monitor&);
    void operator=(const Monitor&);

    void notifyImpl(int) const;

    mutable Cond _cond;
    T _mutex;
    mutable int _nnotify;
};

} // End namespace Ice

//
// Since this monitor implements the Mesa monitor semantics calls to
// notify() or notifyAll() are delayed until the monitor is
// unlocked. This can happen either due to a call to unlock(), or a
// call to wait(). The _nnotify flag keeps track of the number of
// pending notification calls. -1 indicates a broadcast, a positive
// number indicates <n> calls to notify(). The _nnotify flag is reset
// upon initial acquisition of the monitor lock (either through a call
// to lock(), or a return from wait().
//

template <class T> inline
IceUtil::Monitor<T>::Monitor() :
    _nnotify(0)
{
}

template <class T> inline
IceUtil::Monitor<T>::~Monitor()
{
}

template <class T> inline void
IceUtil::Monitor<T>::lock() const
{
    _mutex.lock();
    if(_mutex.willUnlock())
    {
	//
	// On the first mutex acquisition reset the number pending
	// notifications.
	//
	_nnotify = 0;
    }
}

template <class T> inline void
IceUtil::Monitor<T>::unlock() const
{
    if(_mutex.willUnlock())
    {
	//
	// Perform any pending notifications.
	//
	if(_nnotify != 0)
	{
	    notifyImpl(_nnotify);
	}
    }
    _mutex.unlock();

/*
    int nnotify = _nnotify;
    if(_mutex.unlock())
    {
	//
	// Perform any pending notifications.
	//
	if(nnotify != 0)
        {
	    notifyImpl(nnotify);
        }
    }
*/
}

template <class T> inline bool
IceUtil::Monitor<T>::tryLock() const
{
    bool result = _mutex.tryLock();
    if(result && _mutex.willUnlock())
    {
	//
	// On the first mutex acquisition reset the number pending
	// notifications.
	//
	_nnotify = 0;
    }
    return result;
}

template <class T> inline void
IceUtil::Monitor<T>::wait() const
{
    //
    // Perform any pending notifies
    //
    if(_nnotify != 0)
    {
	notifyImpl(_nnotify);
    }

    //
    // Wait for a notification
    //
    try
    {
	_cond.waitImpl(_mutex);
	//
	// Reset the nnotify count once wait() returns.
	//
    }
    catch(...)
    {
	_nnotify = 0;
	throw;
    }

    _nnotify = 0;
}

template <class T> inline bool
IceUtil::Monitor<T>::timedWait(const Time& timeout) const
{
    //
    // Perform any pending notifies.
    //
    if(_nnotify != 0)
    {
	notifyImpl(_nnotify);
    }

    bool rc;
    //
    // Wait for a notification.
    //
    try
    {
	rc = _cond.timedWaitImpl(_mutex, timeout);

	//
	// Reset the nnotify count once wait() returns.
	//
    }
    catch(...)
    {
	_nnotify = 0;
	throw;
    }

    _nnotify = 0;
    return rc;
}

template <class T> inline void
IceUtil::Monitor<T>::notify()
{
    //
    // Increment the _nnotify flag, unless a broadcast has already
    // been requested.
    //
    if(_nnotify != -1)
    {
	++_nnotify;
    }
}

template <class T> inline void
IceUtil::Monitor<T>::notifyAll()
{
    //
    // -1 (indicates broadcast)
    //
    _nnotify = -1;
}


template <class T> inline void
IceUtil::Monitor<T>::notifyImpl(int nnotify) const
{
    //
    // -1 means notifyAll.
    //
    if(nnotify == -1)
    {
	_cond.broadcast();
	return;
    }
    else
    {
	//
	// Otherwise notify n times.
	//
	while(nnotify > 0)
	{
	    _cond.signal();
	    --nnotify;
	}
    }
}

#endif