This file is indexed.

/usr/share/doc/python-gevent-doc/html/gevent.lock.html is in python-gevent-doc 1.1.0-2.

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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">

<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    
    <title>gevent.lock – Locking primitives &mdash; gevent 1.1.0 documentation</title>
    <link rel="stylesheet" href="_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="top" title="gevent 1.1.0 documentation" href="index.html" />
    <link rel="up" title="Synchronization primitives" href="synchronization.html" />
    <link rel="next" title="Implementing servers" href="servers.html" />
    <link rel="prev" title="gevent.event – Basic synchronization primitives: Event and AsyncResult" href="gevent.event.html" /> 
  </head>

<body>

<div id="site-wrapper">
	<div id="header">
		<div id="top">
			<div class="left" id="logo">
                <h1><a id="title" href="index.html">gevent</a></h1>
			</div>
			<div class="left navigation" id="main-nav">
				<ul class="tabbed">
                    <li><a href="http://blog.gevent.org">Blog</a></li>
                    <li><a href="https://github.com/gevent/gevent">Code</a></li>
                    <li class="current-tab"><a href="contents.html">Docs</a></li>
                    <li><a href="http://pypi.python.org/pypi/gevent#downloads">Download</a></li>
					<li><a href="community.html">Mailing list</a></li>
                    <li><a href="https://github.com/gevent/gevent/issues">Issues</a></li>
					<li><a href="http://webchat.freenode.net/?channels=gevent" rel="nofollow">IRC</a></li>
                    <li><a href="sfc.html">Donate</a></li>
                </ul>
				<div class="clearer">&nbsp;</div>
			</div>
			<div class="clearer">&nbsp;</div>
        </div>
    </div>

	<div id="splash">

        <div class="col3big left">

            <div class="document">
                <div class="documentwrapper">
                    <div class="bodywrapper">
                        <div class="body">


                            
  <div class="section" id="module-gevent.lock">
<span id="gevent-lock-locking-primitives"></span><h1><a class="reference internal" href="#module-gevent.lock" title="gevent.lock"><code class="xref py py-mod docutils literal"><span class="pre">gevent.lock</span></code></a> &#8211; Locking primitives<a class="headerlink" href="#module-gevent.lock" title="Permalink to this headline"></a></h1>
<dl class="class">
<dt id="gevent.lock.Semaphore">
<em class="property">class </em><code class="descname">Semaphore</code><span class="sig-paren">(</span><em>value=1</em><span class="sig-paren">)</span> &rarr; Semaphore<a class="headerlink" href="#gevent.lock.Semaphore" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>A semaphore manages a counter representing the number of release()
calls minus the number of acquire() calls, plus an initial value.
The acquire() method blocks if necessary until it can return
without making the counter negative.</p>
<p>If not given, <code class="docutils literal"><span class="pre">value</span></code> defaults to 1.</p>
<p>The semaphore is a context manager and can be used in <code class="docutils literal"><span class="pre">with</span></code> statements.</p>
<p>This Semaphore&#8217;s <code class="docutils literal"><span class="pre">__exit__</span></code> method does not call the trace function
on CPython, but does under PyPy.</p>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="#gevent.lock.BoundedSemaphore" title="gevent.lock.BoundedSemaphore"><code class="xref py py-class docutils literal"><span class="pre">BoundedSemaphore</span></code></a> for a safer version that prevents
some classes of bugs.</p>
</div>
<dl class="method">
<dt id="gevent.lock.Semaphore.acquire">
<code class="descname">acquire</code><span class="sig-paren">(</span><em>blocking=True</em>, <em>timeout=None</em><span class="sig-paren">)</span> &rarr; bool<a class="headerlink" href="#gevent.lock.Semaphore.acquire" title="Permalink to this definition"></a></dt>
<dd><p>Acquire the semaphore.</p>
<div class="admonition caution">
<p class="first admonition-title">Caution</p>
<p class="last">If this semaphore was initialized with a size of 0,
this method will block forever (unless a timeout is given or blocking is
set to false).</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>blocking</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) &#8211; If True (the default), this function will block
until the semaphore is acquired.</li>
<li><strong>timeout</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#float" title="(in Python v2.7)"><em>float</em></a>) &#8211; If given, specifies the maximum amount of seconds
this method will block.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A boolean indicating whether the semaphore was acquired.
If <code class="docutils literal"><span class="pre">blocking</span></code> is True and <code class="docutils literal"><span class="pre">timeout</span></code> is None (the default), then
(so long as this semaphore was initialized with a size greater than 0)
this will always return True. If a timeout was given, and it expired before
the semaphore was acquired, False will be returned. (Note that this can still
raise a <code class="docutils literal"><span class="pre">Timeout</span></code> exception, if some other caller had already started a timer.)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="gevent.lock.Semaphore.locked">
<code class="descname">locked</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gevent.lock.Semaphore.locked" title="Permalink to this definition"></a></dt>
<dd><p>Return a boolean indicating whether the semaphore can be acquired.
Most useful with binary semaphores.</p>
</dd></dl>

<dl class="method">
<dt id="gevent.lock.Semaphore.rawlink">
<code class="descname">rawlink</code><span class="sig-paren">(</span><em>callback</em><span class="sig-paren">)</span> &rarr; None<a class="headerlink" href="#gevent.lock.Semaphore.rawlink" title="Permalink to this definition"></a></dt>
<dd><p>Register a callback to call when a counter is more than zero.</p>
<p><em>callback</em> will be called in the <code class="xref py py-class docutils literal"><span class="pre">Hub</span></code>, so it must not use blocking gevent API.
<em>callback</em> will be passed one argument: this instance.</p>
<p>This method is normally called automatically by <a class="reference internal" href="#gevent.lock.Semaphore.acquire" title="gevent.lock.Semaphore.acquire"><code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code></a> and <a class="reference internal" href="#gevent.lock.Semaphore.wait" title="gevent.lock.Semaphore.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a>; most code
will not need to use it.</p>
</dd></dl>

<dl class="method">
<dt id="gevent.lock.Semaphore.release">
<code class="descname">release</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gevent.lock.Semaphore.release" title="Permalink to this definition"></a></dt>
<dd><p>Release the semaphore, notifying any waiters if needed.</p>
</dd></dl>

<dl class="method">
<dt id="gevent.lock.Semaphore.unlink">
<code class="descname">unlink</code><span class="sig-paren">(</span><em>callback</em><span class="sig-paren">)</span> &rarr; None<a class="headerlink" href="#gevent.lock.Semaphore.unlink" title="Permalink to this definition"></a></dt>
<dd><p>Remove the callback set by <a class="reference internal" href="#gevent.lock.Semaphore.rawlink" title="gevent.lock.Semaphore.rawlink"><code class="xref py py-meth docutils literal"><span class="pre">rawlink()</span></code></a>.</p>
<p>This method is normally called automatically by <a class="reference internal" href="#gevent.lock.Semaphore.acquire" title="gevent.lock.Semaphore.acquire"><code class="xref py py-meth docutils literal"><span class="pre">acquire()</span></code></a>  and <a class="reference internal" href="#gevent.lock.Semaphore.wait" title="gevent.lock.Semaphore.wait"><code class="xref py py-meth docutils literal"><span class="pre">wait()</span></code></a>; most
code will not need to use it.</p>
</dd></dl>

<dl class="method">
<dt id="gevent.lock.Semaphore.wait">
<code class="descname">wait</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span> &rarr; int<a class="headerlink" href="#gevent.lock.Semaphore.wait" title="Permalink to this definition"></a></dt>
<dd><p>Wait until it is possible to acquire this semaphore, or until the optional
<em>timeout</em> elapses.</p>
<div class="admonition caution">
<p class="first admonition-title">Caution</p>
<p class="last">If this semaphore was initialized with a size of 0,
this method will block forever if no timeout is given.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timeout</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#float" title="(in Python v2.7)"><em>float</em></a>) &#8211; If given, specifies the maximum amount of seconds
this method will block.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A number indicating how many times the semaphore can be acquired
before blocking.</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gevent.lock.DummySemaphore">
<em class="property">class </em><code class="descname">DummySemaphore</code><span class="sig-paren">(</span><em>value=None</em><span class="sig-paren">)</span> &rarr; DummySemaphore<a class="headerlink" href="#gevent.lock.DummySemaphore" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>A Semaphore initialized with &#8220;infinite&#8221; initial value. None of its
methods ever block.</p>
<p>This can be used to parameterize on whether or not to actually
guard access to a potentially limited resource. If the resource is
actually limited, such as a fixed-size thread pool, use a real
<a class="reference internal" href="#gevent.lock.Semaphore" title="gevent.lock.Semaphore"><code class="xref py py-class docutils literal"><span class="pre">Semaphore</span></code></a>, but if the resource is unbounded, use an
instance of this class. In that way none of the supporting code
needs to change.</p>
<p>Similarly, it can be used to parameterize on whether or not to
enforce mutual exclusion to some underlying object. If the
underlying object is known to be thread-safe itself mutual
exclusion is not needed and a <code class="docutils literal"><span class="pre">DummySemaphore</span></code> can be used, but
if that&#8217;s not true, use a real <code class="docutils literal"><span class="pre">Semaphore</span></code>.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 1.1rc3: </span>Accept and ignore a <em>value</em> argument for compatibility with Semaphore.</p>
</div>
<dl class="method">
<dt id="gevent.lock.DummySemaphore.locked">
<code class="descname">locked</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gevent.lock.DummySemaphore.locked" title="Permalink to this definition"></a></dt>
<dd><p>A DummySemaphore is never locked so this always returns False.</p>
</dd></dl>

<dl class="method">
<dt id="gevent.lock.DummySemaphore.release">
<code class="descname">release</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gevent.lock.DummySemaphore.release" title="Permalink to this definition"></a></dt>
<dd><p>Releasing a dummy semaphore does nothing.</p>
</dd></dl>

<dl class="method">
<dt id="gevent.lock.DummySemaphore.wait">
<code class="descname">wait</code><span class="sig-paren">(</span><em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#gevent.lock.DummySemaphore.wait" title="Permalink to this definition"></a></dt>
<dd><p>Waiting for a DummySemaphore returns immediately.</p>
</dd></dl>

<dl class="method">
<dt id="gevent.lock.DummySemaphore.acquire">
<code class="descname">acquire</code><span class="sig-paren">(</span><em>blocking=True</em>, <em>timeout=None</em><span class="sig-paren">)</span><a class="headerlink" href="#gevent.lock.DummySemaphore.acquire" title="Permalink to this definition"></a></dt>
<dd><p>A DummySemaphore can always be acquired immediately so this always
returns True and ignores its arguments.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 1.1a1: </span>Always return <em>true</em>.</p>
</div>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gevent.lock.BoundedSemaphore">
<em class="property">class </em><code class="descname">BoundedSemaphore</code><span class="sig-paren">(</span><em>value=1</em><span class="sig-paren">)</span> &rarr; BoundedSemaphore<a class="headerlink" href="#gevent.lock.BoundedSemaphore" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">gevent._semaphore.Semaphore</span></code></p>
<p>A bounded semaphore checks to make sure its current value doesn&#8217;t
exceed its initial value. If it does, <code class="xref py py-class docutils literal"><span class="pre">ValueError</span></code> is
raised. In most situations semaphores are used to guard resources
with limited capacity. If the semaphore is released too many times
it&#8217;s a sign of a bug.</p>
<p>If not given, <em>value</em> defaults to 1.</p>
</dd></dl>

</div>


          <p><strong>Next page: <a href="servers.html" title="next chapter">Implementing servers</a></strong></p>

                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col3 right">
            <div class="body">
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
          <h4 class="label label-blue"><a href="contents.html">Navigation</a></h4>
          <ul>
          <li>Next: <a href="servers.html" title="next chapter">Implementing servers</a></li>
          <li>Previous: <a href="gevent.event.html" title="previous chapter"><code class="docutils literal"><span class="pre">gevent.event</span></code> &#8211; Basic synchronization primitives: Event and AsyncResult</a></li>
          <li>Up: <a href="synchronization.html">Synchronization primitives</a></li>
          </ul>
          <h4 class="label label-orange">Related pages</h4>
          <ul>
          <li><a href="https://github.com/gevent/gevent/tree/master/examples"
              title="Browse gevent/examples in the development repository">Code examples</a></li>
          </ul>

        </div>
      </div>
            </div>
        </div>
 		<div class="clearer">&nbsp;</div>
    </div>

	<div id="footer">

		<div class="left" id="footer-left">

            <p>version 1.1.0 <a href="http://denisbilenko.com" class="quiet-link">&copy; 2009-2015 Denis Bilenko, gevent contributors</a></p>

			<div class="clearer">&nbsp;</div>

		</div>

		<div class="right" id="footer-right">

			<p class="large"><a href="http://blog.gevent.org">Blog</a> <span class="text-separator">|</span> <a href="https://github.com/gevent/gevent">Code</a> <span class="text-separator">|</span> <a href="contents.html">Docs</a> <span class="text-separator">|</span> <a href="http://pypi.python.org/pypi/gevent">Download</a> <span class="text-separator">|</span> <a href="community.html">Mailing list</a> <span class="text-separator">|</span> <a href="https://github.com/gevent/gevent/issues">Issue tracker</a> <span class="text-separator">|</span> <a href="http://webchat.freenode.net/?channels=gevent" rel="nofollow">IRC</a> <span class="text-separator">|</span> <a href="#top" class="quiet">Page Top &uarr;</a></p>

		</div>

		<div class="clearer">&nbsp;</div>

	</div>

</div>

</body>
</html>