Commit 3d929998 authored by Denis Bilenko's avatar Denis Bilenko

thread: follow pep8

parent 471b085d
"""Implementation of the standard :mod:`thread` module that spawns greenlets.
.. note::
This module is a helper for :mod:`gevent.monkey` and is not intended to be
used directly. For spawning greenlets in your applications, prefer
:class:`Greenlet` class.
......@@ -12,19 +12,23 @@ from gevent.hub import getcurrent, GreenletExit
from gevent.greenlet import Greenlet
from gevent.coros import Semaphore as LockType
def get_ident(gr=None):
if gr is None:
return id(getcurrent())
else:
return id(gr)
def start_new_thread(function, args=(), kwargs={}):
greenlet = Greenlet.spawn(function, *args, **kwargs)
return get_ident(greenlet)
def allocate_lock():
return LockType(1)
def exit():
raise GreenletExit
......
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