Merge
This commit is contained in:
@@ -68,7 +68,7 @@ class Popen(subprocess_orig.Popen):
|
|||||||
|
|
||||||
# Borrow subprocess.call() and check_call(), but patch them so they reference
|
# Borrow subprocess.call() and check_call(), but patch them so they reference
|
||||||
# OUR Popen class rather than subprocess.Popen.
|
# OUR Popen class rather than subprocess.Popen.
|
||||||
call = new.function(subprocess_orig.call.func_code, globals())
|
call = new.function(subprocess_orig.call.func_code, globals())
|
||||||
try:
|
try:
|
||||||
check_call = new.function(subprocess_orig.check_call.func_code, globals())
|
check_call = new.function(subprocess_orig.check_call.func_code, globals())
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@@ -83,7 +83,7 @@ class GreenPool(object):
|
|||||||
gt.link(self._spawn_done)
|
gt.link(self._spawn_done)
|
||||||
return gt
|
return gt
|
||||||
|
|
||||||
def _spawn_n_impl(self, func, args, kwargs, coro=None):
|
def _spawn_n_impl(self, func, args, kwargs, coro):
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
func(*args, **kwargs)
|
func(*args, **kwargs)
|
||||||
@@ -108,11 +108,11 @@ class GreenPool(object):
|
|||||||
# itself -- instead, just execute in the current coroutine
|
# itself -- instead, just execute in the current coroutine
|
||||||
current = greenthread.getcurrent()
|
current = greenthread.getcurrent()
|
||||||
if self.sem.locked() and current in self.coroutines_running:
|
if self.sem.locked() and current in self.coroutines_running:
|
||||||
self._spawn_n_impl(function, args, kwargs)
|
self._spawn_n_impl(function, args, kwargs, None)
|
||||||
else:
|
else:
|
||||||
self.sem.acquire()
|
self.sem.acquire()
|
||||||
g = greenthread.spawn_n(self._spawn_n_impl,
|
g = greenthread.spawn_n(self._spawn_n_impl,
|
||||||
function, args, kwargs, coro=True)
|
function, args, kwargs, True)
|
||||||
if not self.coroutines_running:
|
if not self.coroutines_running:
|
||||||
self.no_coros_running = event.Event()
|
self.no_coros_running = event.Event()
|
||||||
self.coroutines_running.add(g)
|
self.coroutines_running.add(g)
|
||||||
|
Reference in New Issue
Block a user