summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/changelog.rst4
-rw-r--r--doc/status.rst2
-rw-r--r--doc/using.rst17
3 files changed, 11 insertions, 12 deletions
diff --git a/doc/changelog.rst b/doc/changelog.rst
index 5853cce..41343a2 100644
--- a/doc/changelog.rst
+++ b/doc/changelog.rst
@@ -4,7 +4,9 @@ Changelog
Version 0.3 (development version)
---------------------------------
-* :func:`wrap_greenthread` now also works on greenlet objects.
+* :func:`wrap_greenthread` now raises an exception if the greenthread is
+ running or already finished. In debug mode, the exception is not more logged
+ to sys.stderr for greenthreads.
2014-10-21: version 0.2
-----------------------
diff --git a/doc/status.rst b/doc/status.rst
index 7b0802d..439af37 100644
--- a/doc/status.rst
+++ b/doc/status.rst
@@ -1,8 +1,6 @@
To do
=====
-* wrap_greenthread() must not log the exception to sys.stderr if the
- greenthread didn't start
* register signals in eventlet hub, only needed for pyevent hub?
* port greenio examples to aiogreen
* write unit tests for, and maybe also examples for:
diff --git a/doc/using.rst b/doc/using.rst
index 8e62110..e647614 100644
--- a/doc/using.rst
+++ b/doc/using.rst
@@ -111,12 +111,13 @@ aiogreen specific functions:
raise Return(x + y)
def green_sum():
- task = asyncio.async(coro_slow_sum(1, 2))
-
loop.call_soon(progress)
+ task = asyncio.async(coro_slow_sum(1, 2))
+
value = aiogreen.link_future(task)
print("1 + 2 = %s" % value)
+
loop.stop()
asyncio.set_event_loop_policy(aiogreen.EventLoopPolicy())
@@ -138,11 +139,9 @@ aiogreen specific functions:
The Future object waits for the completion of a greenthread.
- The greenlet must not be running.
-
- In debug mode, if the greenthread raises an exception, the exception is
- logged to ``sys.stderr`` by eventlet, even if the exception is copied to the
- Future object.
+ The greenthread or greenlet must be wrapped before its execution starts.
+ If the greenthread or greenlet is running or already finished, an exception
+ is raised.
Example of trollius coroutine waiting for a greenthread. The ``progress()``
callback is called regulary to see that the event loop in not blocked::
@@ -162,11 +161,11 @@ aiogreen specific functions:
@asyncio.coroutine
def coro_sum():
- gt = eventlet.spawn(slow_sum, 1, 2)
-
loop.call_soon(progress)
+ gt = eventlet.spawn(slow_sum, 1, 2)
fut = aiogreen.wrap_greenthread(gt, loop=loop)
+
result = yield From(fut)
print("1 + 2 = %s" % result)