Commit 856ccb56 authored by Denis Bilenko's avatar Denis Bilenko

make gevent.thread spawn Greenlets, not raw greenlets

parent 6d48a45a
"""implements standard module 'thread' with greenlets""" """implements standard module 'thread' with greenlets"""
__thread = __import__('thread') __thread = __import__('thread')
from gevent.hub import getcurrent, GreenletExit, spawn_raw from gevent.hub import getcurrent, GreenletExit
from gevent.greenlet import Greenlet
from gevent.coros import Semaphore as LockType from gevent.coros import Semaphore as LockType
def get_ident(gr=None): def get_ident(gr=None):
...@@ -10,7 +11,7 @@ def get_ident(gr=None): ...@@ -10,7 +11,7 @@ def get_ident(gr=None):
return id(gr) return id(gr)
def start_new_thread(function, args=(), kwargs={}): def start_new_thread(function, args=(), kwargs={}):
greenlet = spawn_raw(function, *args, **kwargs) greenlet = Greenlet.spawn(function, *args, **kwargs)
return get_ident(greenlet) return get_ident(greenlet)
def allocate_lock(): def allocate_lock():
......
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