diff options
| author | Ryan Williams <rdw@lindenlab.com> | 2010-02-25 17:55:52 -0500 |
|---|---|---|
| committer | Ryan Williams <rdw@lindenlab.com> | 2010-02-25 17:55:52 -0500 |
| commit | 74c3c8fe9e67ed0e31b8c3d80b9745f1eabaf70b (patch) | |
| tree | c7af354d20f29ba4a376e241f13d51b0e5afacf5 /doc/basic_usage.rst | |
| parent | 4d9ef644c203e51f727387d5f39c6d64e7fa7d18 (diff) | |
| download | eventlet-74c3c8fe9e67ed0e31b8c3d80b9745f1eabaf70b.tar.gz | |
New module convenience; moved convenience functions in there. Sectioned off the basic_usage document a little differently to highlight the convenience functions. Wrote a bunch more serve tests.
Diffstat (limited to 'doc/basic_usage.rst')
| -rw-r--r-- | doc/basic_usage.rst | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/doc/basic_usage.rst b/doc/basic_usage.rst index c7a68e1..db242b3 100644 --- a/doc/basic_usage.rst +++ b/doc/basic_usage.rst @@ -15,6 +15,9 @@ The design goal for Eventlet's API is simplicity and readability. You should be Though Eventlet has many modules, much of the most-used stuff is accessible simply by doing ``import eventlet``. Here's a quick summary of the functionality available in the ``eventlet`` module, with links to more verbose documentation on each. +Greenthread Spawn +----------------------- + .. function:: eventlet.spawn(func, *args, **kw) This launches a greenthread to call *func*. Spawning off multiple greenthreads gets work done in parallel. The return value from ``spawn`` is a :class:`greenthread.GreenThread` object, which can be used to retrieve the return value of *func*. See :func:`spawn <eventlet.greenthread.spawn>` for more details. @@ -27,14 +30,13 @@ Though Eventlet has many modules, much of the most-used stuff is accessible simp Spawns *func* after *seconds* have elapsed; a delayed version of :func:`spawn`. To abort the spawn and prevent *func* from being called, call :meth:`GreenThread.cancel` on the return value of :func:`spawn_after`. See :func:`spawn_after <eventlet.greenthread.spawn_after>` for more details. +Greenthread Control +----------------------- + .. function:: eventlet.sleep(seconds=0) Suspends the current greenthread and allows others a chance to process. See :func:`sleep <eventlet.greenthread.sleep>` for more details. -.. autofunction:: eventlet.connect - -.. autofunction:: eventlet.listen - .. class:: eventlet.GreenPool Pools control concurrency. It's very common in applications to want to consume only a finite amount of memory, or to restrict the amount of connections that one part of the code holds open so as to leave more for the rest, or to behave consistently in the face of unpredictable input data. GreenPools provide this control. See :class:`GreenPool <eventlet.greenpool.GreenPool>` for more on how to use these. @@ -53,6 +55,9 @@ Though Eventlet has many modules, much of the most-used stuff is accessible simp Timeout objects are context managers, and so can be used in with statements. See :class:`Timeout <eventlet.timeout.Timeout>` for more details. + +Patching Functions +--------------------- .. function:: eventlet.import_patched(modulename, *additional_modules, **kw_additional_modules) @@ -62,6 +67,15 @@ Though Eventlet has many modules, much of the most-used stuff is accessible simp Globally patches certain system modules to be greenthread-friendly. The keyword arguments afford some control over which modules are patched. If *all* is True, then all modules are patched regardless of the other arguments. If it's False, then the rest of the keyword arguments control patching of specific subsections of the standard library. Most patch the single module of the same name (os, time, select). The exceptions are socket, which also patches the ssl module if present; and thread, which patches thread, threading, and Queue. It's safe to call monkey_patch multiple times. For more information see :ref:`monkey-patch`. +Network Convenience Functions +------------------------------ + +.. autofunction:: eventlet.connect + +.. autofunction:: eventlet.listen + +.. autofunction:: eventlet.serve +.. autofunction:: eventlet.StopServe These are the basic primitives of Eventlet; there are a lot more out there in the other Eventlet modules; check out the :doc:`modules`. |
