| | | |
Offset 89, 23 lines modified | Offset 89, 75 lines modified |
89 | <p·class="first·admonition-title">Warning</p> | 89 | <p·class="first·admonition-title">Warning</p> |
90 | <p·class="last">Forking·a·process·that·uses·greenlets·does·not·eliminate·all·non-running | 90 | <p·class="last">Forking·a·process·that·uses·greenlets·does·not·eliminate·all·non-running |
91 | greenlets.·Any·that·were·scheduled·in·the·hub·of·the·forking·thread·in·the·parent | 91 | greenlets.·Any·that·were·scheduled·in·the·hub·of·the·forking·thread·in·the·parent |
92 | remain·scheduled·in·the·child;·compare·this·to·how·normal·threads·operate.·(This·behaviour | 92 | remain·scheduled·in·the·child;·compare·this·to·how·normal·threads·operate.·(This·behaviour |
93 | may·change·is·a·subsequent·major·release.)</p> | 93 | may·change·is·a·subsequent·major·release.)</p> |
94 | </div> | 94 | </div> |
95 | <dl·class="function"> | 95 | <dl·class="function"> |
| 96 | <dt·id="gevent.os.tp_read"> |
| 97 | <code·class="descname">tp_read</code><span·class="sig-paren">(</span><em>fd</em>,·<em>n</em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#tp_read"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.tp_read"·title="Permalink·to·this·definition">¶</a></dt> |
| 98 | <dd><p>Read·up·to·<em>n</em>·bytes·from·file·descriptor·<em>fd</em>.·Return·a·string |
| 99 | containing·the·bytes·read.·If·end-of-file·is·reached,·an·empty·string |
| 100 | is·returned.</p> |
| 101 | <p>Reading·is·done·using·the·threadpool.</p> |
| 102 | </dd></dl> |
| |
| 103 | <dl·class="function"> |
| 104 | <dt·id="gevent.os.fork"> |
| 105 | <code·class="descname">fork</code><span·class="sig-paren">(</span><em>*args</em>,·<em>**kwargs</em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#fork"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.fork"·title="Permalink·to·this·definition">¶</a></dt> |
| 106 | <dd><p>Forks·a·child·process·and·starts·a·child·watcher·for·it·in·the |
| 107 | parent·process·so·that·<code·class="docutils·literal·notranslate"><span·class="pre">waitpid</span></code>·and·SIGCHLD·work·as·expected.</p> |
| 108 | <p>This·implementation·of·<code·class="docutils·literal·notranslate"><span·class="pre">fork</span></code>·is·a·wrapper·for·<a·class="reference·internal"·href="#gevent.os.fork_and_watch"·title="gevent.os.fork_and_watch"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">fork_and_watch()</span></code></a> |
| 109 | when·the·environment·variable·<code·class="docutils·literal·notranslate"><span·class="pre">GEVENT_NOWAITPID</span></code>·is·<em>not</em>·defined. |
| 110 | This·is·the·default·and·should·be·used·by·most·applications.</p> |
| 111 | <div·class="versionchanged"> |
| 112 | <p><span·class="versionmodified">Changed·in·version·1.1b2.</span></p> |
| 113 | </div> |
| 114 | </dd></dl> |
| |
| 115 | <dl·class="function"> |
96 | <dt·id="gevent.os.nb_write"> | 116 | <dt·id="gevent.os.nb_write"> |
97 | <code·class="descname">nb_write</code><span·class="sig-paren">(</span><em>fd</em>,·<em>buf</em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#nb_write"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.nb_write"·title="Permalink·to·this·definition">¶</a></dt> | 117 | <code·class="descname">nb_write</code><span·class="sig-paren">(</span><em>fd</em>,·<em>buf</em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#nb_write"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.nb_write"·title="Permalink·to·this·definition">¶</a></dt> |
98 | <dd><p>Write·some·number·of·bytes·from·buffer·<em>buf</em>·to·file | 118 | <dd><p>Write·some·number·of·bytes·from·buffer·<em>buf</em>·to·file |
99 | descriptor·<em>fd</em>.·Return·the·number·of·bytes·written,·which·may | 119 | descriptor·<em>fd</em>.·Return·the·number·of·bytes·written,·which·may |
100 | be·less·than·the·length·of·<em>buf</em>.</p> | 120 | be·less·than·the·length·of·<em>buf</em>.</p> |
101 | <p>The·file·descriptor·must·be·in·non-blocking·mode.</p> | 121 | <p>The·file·descriptor·must·be·in·non-blocking·mode.</p> |
102 | </dd></dl> | 122 | </dd></dl> |
| |
103 | <dl·class="function"> | 123 | <dl·class="function"> |
| 124 | <dt·id="gevent.os.tp_write"> |
| 125 | <code·class="descname">tp_write</code><span·class="sig-paren">(</span><em>fd</em>,·<em>buf</em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#tp_write"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.tp_write"·title="Permalink·to·this·definition">¶</a></dt> |
| 126 | <dd><p>Write·bytes·from·buffer·<em>buf</em>·to·file·descriptor·<em>fd</em>.·Return·the |
| 127 | number·of·bytes·written.</p> |
| 128 | <p>Writing·is·done·using·the·threadpool.</p> |
| 129 | </dd></dl> |
| |
| 130 | <dl·class="function"> |
| 131 | <dt·id="gevent.os.waitpid"> |
| 132 | <code·class="descname">waitpid</code><span·class="sig-paren">(</span><em>pid</em>,·<em>options</em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#waitpid"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.waitpid"·title="Permalink·to·this·definition">¶</a></dt> |
| 133 | <dd><p>Wait·for·a·child·process·to·finish.</p> |
| 134 | <p>If·the·child·process·was·spawned·using |
| 135 | <a·class="reference·internal"·href="#gevent.os.fork_and_watch"·title="gevent.os.fork_and_watch"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">fork_and_watch()</span></code></a>,·then·this·function·behaves |
| 136 | cooperatively.·If·not,·it·<em>may</em>·have·race·conditions;·see |
| 137 | <a·class="reference·internal"·href="#gevent.os.fork_gevent"·title="gevent.os.fork_gevent"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">fork_gevent()</span></code></a>·for·more·information.</p> |
| 138 | <p>The·arguments·are·as·for·the·underlying |
| 139 | <a·class="reference·external"·href="http://docs.python.org/library/os.html#os.waitpid"·title="(in·Python·v2.7)"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">os.waitpid()</span></code></a>.·Some·combinations·of·<em>options</em>·may·not |
| 140 | be·supported·cooperatively·(as·of·1.1·that·includes |
| 141 | WUNTRACED).·Using·a·<em>pid</em>·of·0·to·request·waiting·on·only·processes |
| 142 | from·the·current·process·group·is·not·cooperative.</p> |
| 143 | <p>Availability:·POSIX.</p> |
| 144 | <div·class="versionadded"> |
| 145 | <p><span·class="versionmodified">New·in·version·1.1b1.</span></p> |
| 146 | </div> |
| 147 | <div·class="versionchanged"> |
| 148 | <p><span·class="versionmodified">Changed·in·version·1.2a1:·</span>More·cases·are·handled·in·a·cooperative·manner.</p> |
| 149 | </div> |
| 150 | </dd></dl> |
| |
| 151 | <dl·class="function"> |
104 | <dt·id="gevent.os.fork_and_watch"> | 152 | <dt·id="gevent.os.fork_and_watch"> |
105 | <code·class="descname">fork_and_watch</code><span·class="sig-paren">(</span><em>callback=None</em>,·<em>loop=None</em>,·<em>ref=False</em>,·<em>fork=<function·fork_gevent></em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#fork_and_watch"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.fork_and_watch"·title="Permalink·to·this·definition">¶</a></dt> | 153 | <code·class="descname">fork_and_watch</code><span·class="sig-paren">(</span><em>callback=None</em>,·<em>loop=None</em>,·<em>ref=False</em>,·<em>fork=<function·fork_gevent></em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#fork_and_watch"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.fork_and_watch"·title="Permalink·to·this·definition">¶</a></dt> |
106 | <dd><p>Fork·a·child·process·and·start·a·child·watcher·for·it·in·the·parent·process.</p> | 154 | <dd><p>Fork·a·child·process·and·start·a·child·watcher·for·it·in·the·parent·process.</p> |
107 | <p>This·call·cooperates·with·<a·class="reference·internal"·href="#gevent.os.waitpid"·title="gevent.os.waitpid"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">waitpid()</span></code></a>·to·enable·cooperatively·waiting | 155 | <p>This·call·cooperates·with·<a·class="reference·internal"·href="#gevent.os.waitpid"·title="gevent.os.waitpid"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">waitpid()</span></code></a>·to·enable·cooperatively·waiting |
108 | for·children·to·finish.·When·monkey-patching,·these·functions·are·patched·in·as | 156 | for·children·to·finish.·When·monkey-patching,·these·functions·are·patched·in·as |
109 | <a·class="reference·external"·href="http://docs.python.org/library/os.html#os.fork"·title="(in·Python·v2.7)"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">os.fork()</span></code></a>·and·<a·class="reference·external"·href="http://docs.python.org/library/os.html#os.waitpid"·title="(in·Python·v2.7)"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">os.waitpid()</span></code></a>,·respectively.</p> | 157 | <a·class="reference·external"·href="http://docs.python.org/library/os.html#os.fork"·title="(in·Python·v2.7)"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">os.fork()</span></code></a>·and·<a·class="reference·external"·href="http://docs.python.org/library/os.html#os.waitpid"·title="(in·Python·v2.7)"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">os.waitpid()</span></code></a>,·respectively.</p> |
110 | <p>In·the·child·process,·this·function·calls·<code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">gevent.hub.reinit()</span></code>·before·returning.</p> | 158 | <p>In·the·child·process,·this·function·calls·<code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">gevent.hub.reinit()</span></code>·before·returning.</p> |
Offset 134, 33 lines modified | Offset 186, 26 lines modified |
134 | <div·class="admonition·seealso"> | 186 | <div·class="admonition·seealso"> |
135 | <p·class="first·admonition-title">See·also</p> | 187 | <p·class="first·admonition-title">See·also</p> |
136 | <p·class="last"><a·class="reference·internal"·href="gevent.monkey.html#gevent.monkey.get_original"·title="gevent.monkey.get_original"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">gevent.monkey.get_original()</span></code></a>·To·access·the·builtin·<a·class="reference·external"·href="http://docs.python.org/library/os.html#os.fork"·title="(in·Python·v2.7)"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">os.fork()</span></code></a>.</p> | 188 | <p·class="last"><a·class="reference·internal"·href="gevent.monkey.html#gevent.monkey.get_original"·title="gevent.monkey.get_original"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">gevent.monkey.get_original()</span></code></a>·To·access·the·builtin·<a·class="reference·external"·href="http://docs.python.org/library/os.html#os.fork"·title="(in·Python·v2.7)"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">os.fork()</span></code></a>.</p> |
137 | </div> | 189 | </div> |
138 | </dd></dl> | 190 | </dd></dl> |
| |
139 | <dl·class="function"> | 191 | <dl·class="function"> |
| 192 | <dt·id="gevent.os.make_nonblocking"> |
| 193 | <code·class="descname">make_nonblocking</code><span·class="sig-paren">(</span><em>fd</em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#make_nonblocking"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.make_nonblocking"·title="Permalink·to·this·definition">¶</a></dt> |
| 194 | <dd><p>Put·the·file·descriptor·<em>fd</em>·into·non-blocking·mode·if |
| 195 | possible.</p> |
| 196 | <table·class="docutils·field-list"·frame="void"·rules="none"> |
| 197 | <col·class="field-name"·/> |
| 198 | <col·class="field-body"·/> |
| 199 | <tbody·valign="top"> |
| 200 | <tr·class="field-odd·field"><th·class="field-name">Returns:</th><td·class="field-body">A·boolean·value·that·evaluates·to·True·if·successful.</td> |
| 201 | </tr> |
| 202 | </tbody> |
| 203 | </table> |
140 | <dt·id="gevent.os.waitpid"> | |
141 | <code·class="descname">waitpid</code><span·class="sig-paren">(</span><em>pid</em>,·<em>options</em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#waitpid"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.waitpid"·title="Permalink·to·this·definition">¶</a></dt> | |
142 | <dd><p>Wait·for·a·child·process·to·finish.</p> | |
143 | <p>If·the·child·process·was·spawned·using | |
144 | <a·class="reference·internal"·href="#gevent.os.fork_and_watch"·title="gevent.os.fork_and_watch"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">fork_and_watch()</span></code></a>,·then·this·function·behaves | |
145 | cooperatively.·If·not,·it·<em>may</em>·have·race·conditions;·see | |
146 | <a·class="reference·internal"·href="#gevent.os.fork_gevent"·title="gevent.os.fork_gevent"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">fork_gevent()</span></code></a>·for·more·information.</p> | |
147 | <p>The·arguments·are·as·for·the·underlying | |
148 | <a·class="reference·external"·href="http://docs.python.org/library/os.html#os.waitpid"·title="(in·Python·v2.7)"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">os.waitpid()</span></code></a>.·Some·combinations·of·<em>options</em>·may·not | |
149 | be·supported·cooperatively·(as·of·1.1·that·includes | |
150 | WUNTRACED).·Using·a·<em>pid</em>·of·0·to·request·waiting·on·only·processes | |
151 | from·the·current·process·group·is·not·cooperative.</p> | |
152 | <p>Availability:·POSIX.</p> | |
153 | <div·class="versionadded"> | |
154 | <p><span·class="versionmodified">New·in·version·1.1b1.</span></p> | |
155 | </div> | |
156 | <div·class="versionchanged"> | |
157 | <p><span·class="versionmodified">Changed·in·version·1.2a1:·</span>More·cases·are·handled·in·a·cooperative·manner.</p> | |
158 | </div> | |
159 | </dd></dl> | 204 | </dd></dl> |
| |
160 | <dl·class="function"> | 205 | <dl·class="function"> |
161 | <dt·id="gevent.os.forkpty_and_watch"> | 206 | <dt·id="gevent.os.forkpty_and_watch"> |
162 | <code·class="descname">forkpty_and_watch</code><span·class="sig-paren">(</span><em>callback=None</em>,·<em>loop=None</em>,·<em>ref=False</em>,·<em>forkpty=<function·forkpty_gevent></em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#forkpty_and_watch"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.forkpty_and_watch"·title="Permalink·to·this·definition">¶</a></dt> | 207 | <code·class="descname">forkpty_and_watch</code><span·class="sig-paren">(</span><em>callback=None</em>,·<em>loop=None</em>,·<em>ref=False</em>,·<em>forkpty=<function·forkpty_gevent></em><span·class="sig-paren">)</span><a·class="reference·internal"·href="../_modules/gevent/os.html#forkpty_and_watch"><span·class="viewcode-link">[source]</span></a><a·class="headerlink"·href="#gevent.os.forkpty_and_watch"·title="Permalink·to·this·definition">¶</a></dt> |
163 | <dd><p>Like·<a·class="reference·internal"·href="#gevent.os.fork_and_watch"·title="gevent.os.fork_and_watch"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">fork_and_watch()</span></code></a>,·except·using·<a·class="reference·internal"·href="#gevent.os.forkpty_gevent"·title="gevent.os.forkpty_gevent"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">forkpty_gevent()</span></code></a>.</p> | 208 | <dd><p>Like·<a·class="reference·internal"·href="#gevent.os.fork_and_watch"·title="gevent.os.fork_and_watch"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">fork_and_watch()</span></code></a>,·except·using·<a·class="reference·internal"·href="#gevent.os.forkpty_gevent"·title="gevent.os.forkpty_gevent"><code·class="xref·py·py-func·docutils·literal·notranslate"><span·class="pre">forkpty_gevent()</span></code></a>.</p> |
164 | <p>Availability:·Some·Unix·systems.</p> | 209 | <p>Availability:·Some·Unix·systems.</p> |
Offset 204, 27 lines modified | Offset 249, 14 lines modified |
204 | </div> | 249 | </div> |
205 | <div·class="versionadded"> | 250 | <div·class="versionadded"> |
206 | <p><span·class="versionmodified">New·in·version·1.1b5.</span></p> | 251 | <p><span·class="versionmodified">New·in·version·1.1b5.</span></p> |
207 | </div> | 252 | </div> |
208 | </dd></dl> | 253 | </dd></dl> |
Max diff block lines reached; 4598/15888 bytes (28.94%) of diff not shown.
|