doc: update threading.rst

There are two ways to give other greenthread chance to run:
greenthread.sleep(0) or time.sleep(0). Add the second way in
threading.rst and recommend the second way for contributors.

Change-Id: I33dc73a0edfa5fde0e5fa8051a594874ab166970
This commit is contained in:
ChangBo Guo(gcb) 2015-11-05 16:57:47 +08:00
parent 415b221e33
commit 9885787db1

View File

@ -31,7 +31,9 @@ delays in the case that there is only a single green thread::
from eventlet import greenthread from eventlet import greenthread
... ...
greenthread.sleep(0) greenthread.sleep(0)
In current code, time.sleep(0does the same thing as greenthread.sleep(0) if
time module is patched through eventlet.monkey_patch(). To be explicit, we recommend
contributors use ``greenthread.sleep()`` instead of ``time.sleep()``.
MySQL access and eventlet MySQL access and eventlet
------------------------- -------------------------