summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDenis Bilenko <denis@ag-projects.com>2008-10-24 19:28:24 +0700
committerDenis Bilenko <denis@ag-projects.com>2008-10-24 19:28:24 +0700
commit19a326c401362f64f00fae668542e46db81d5261 (patch)
tree49f2c94e0ff6e903e324991bba2ad47a9d86ef0f /examples
parent7003c769c99031d99a523af84d787d1995e01016 (diff)
downloadeventlet-19a326c401362f64f00fae668542e46db81d5261.tar.gz
twisted callbacks are run in the mainloop greenlet and therefore shouldn't block. fixed example to use spawn
Diffstat (limited to 'examples')
-rw-r--r--examples/twisted_ex2.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/twisted_ex2.py b/examples/twisted_ex2.py
index 5ece6cf..6c7cf88 100644
--- a/examples/twisted_ex2.py
+++ b/examples/twisted_ex2.py
@@ -5,6 +5,7 @@ from twisted.protocols import basic
from twisted.internet import reactor
from twisted.internet.error import ConnectionDone
+from eventlet.api import spawn
from eventlet.channel import channel
from eventlet.twisteds.util import block_on
@@ -12,7 +13,7 @@ from eventlet.twisteds.util import block_on
class LineOnlyReceiver(basic.LineOnlyReceiver):
def lineReceived(self, line):
- self.channel.send(line)
+ spawn(self.channel.send, line)
def connectionLost(self, reason):
self.channel.send_exception(reason.value)