Commit eba87aa7 authored by Jason Madden's avatar Jason Madden

explicit note about socket thread affinity. [skip ci]

parent 78a403e7
...@@ -8,6 +8,14 @@ items in the standard :mod:`socket` module exactly, but the ...@@ -8,6 +8,14 @@ items in the standard :mod:`socket` module exactly, but the
synchronous functions in this module only block the current greenlet synchronous functions in this module only block the current greenlet
and let the others run. and let the others run.
.. warning:: gevent's sockets have thread affinity. That is, they can
only be used from the operating system thread that
created them (any greenlet in that thread can use the
socket). The results of attempting to use the socket in
another thread (for example, passing it to the
threadpool) are not defined (but one common outcome is a
``LoopExit`` exception).
For convenience, exceptions (like :class:`error <socket.error>` and For convenience, exceptions (like :class:`error <socket.error>` and
:class:`timeout <socket.timeout>`) as well as the constants from the :class:`timeout <socket.timeout>`) as well as the constants from the
:mod:`socket` module are imported into this module. :mod:`socket` module are imported into this module.
...@@ -17,7 +25,7 @@ The exact API exposed by this module varies depending on what version ...@@ -17,7 +25,7 @@ The exact API exposed by this module varies depending on what version
of Python you are using. The documents below describe the API for of Python you are using. The documents below describe the API for
Python 2 and Python 3, respectively. Python 2 and Python 3, respectively.
.. warning:: All the described APIs should be imported from .. caution:: All the described APIs should be imported from
``gevent.socket``, and *not* from their implementation modules. ``gevent.socket``, and *not* from their implementation modules.
Their organization is an implementation detail that may change at Their organization is an implementation detail that may change at
any time. any time.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment