@@ -194,7 +194,8 @@ <h3 id="contributors">Contributors</h3>
194194< a href ="https://github.com/Lothiraldan "> Boris Feld</ a >
195195< a href ="https://github.com/youngsterxyf "> youngsterxyf</ a >
196196< a href ="https://github.com/ehebert "> Eddie Hebert</ a >
197- < a href ="http://notmyidea.org "> Alexis Metaireau</ a > </ p >
197+ < a href ="http://notmyidea.org "> Alexis Metaireau</ a >
198+ < a href ="https://github.com/djv "> Daniel Velkov</ a > </ p >
198199< p > This is a collaborative document published under MIT license.
199200Have something to add? See a typo? Fork and issue a
200201pull request < a href ="https://github.com/sdiehl/gevent-tutorial "> Github</ a > .
@@ -215,7 +216,7 @@ <h2 id="synchronous-asynchronous-execution">Synchronous & Asynchronous Execu
215216< em > asynchronously</ em > instead of one at a time
216217< em > synchronously</ em > . A switch between the two
217218executions is known as a < em > context switch</ em > .</ p >
218- < p > A context switch in gevent done through
219+ < p > A context switch in gevent is done through
219220< em > yielding</ em > . In this case example we have
220221two contexts which yield to each other through invoking
221222< code > gevent.sleep(0)</ code > .</ p >
@@ -338,16 +339,16 @@ <h2 id="synchronous-asynchronous-execution">Synchronous & Asynchronous Execu
338339Task 8 done
339340Task 9 done
340341Asynchronous:
341- Task 1 done
342+ Task 0 done
343+ Task 2 done
342344Task 6 done
343345Task 5 done
344- Task 0 done
345- Task 9 done
346- Task 8 done
347- Task 7 done
348346Task 4 done
347+ Task 7 done
348+ Task 8 done
349+ Task 9 done
350+ Task 1 done
349351Task 3 done
350- Task 2 done
351352</ pre > </ code > </ p >
352353< p > In the synchronous case all the tasks are run sequentially,
353354which results in the main programming < em > blocking</ em > (
@@ -506,6 +507,7 @@ <h2 id="spawning-threads">Spawning Threads</h2>
506507< p > In addition to using the base Greenlet class, you may also subclass
507508Greenlet class and overload the < code > _run</ code > method.</ p >
508509< pre > < code class ="python ">
510+ import gevent
509511from gevent import Greenlet
510512
511513class MyGreenlet(Greenlet):
@@ -922,11 +924,12 @@ <h2 id="actors">Actors</h2>
922924one very simply using a Queue inside of a subclassed Greenlet.</ p >
923925< pre >
924926< code class ="python "> import gevent
927+ from gevent.queue import Queue
925928
926929class Actor(gevent.Greenlet):
927930
928931 def __init__(self):
929- self.inbox = queue. Queue()
932+ self.inbox = Queue()
930933 Greenlet.__init__(self)
931934
932935 def receive(self, message):
@@ -1075,7 +1078,7 @@ <h2 id="wsgi-servers">WSGI Servers</h2>
10751078instead of libev. Libevent included a fast HTTP server which was
10761079used by gevent's < code > wsgi</ code > server. </ p >
10771080< p > In gevent 1.0.x there is no http server included. Instead
1078- < code > gevent.wsgi</ code > it is now an alias for the pure Python server in
1081+ < code > gevent.wsgi</ code > is now an alias for the pure Python server in
10791082< code > gevent.pywsgi</ code > .</ p >
10801083< h2 id ="streaming-servers "> Streaming Servers</ h2 >
10811084< p > < strong > If you are using gevent 1.0.x, this section does not apply</ strong > </ p >
0 commit comments