FIX: Removing coroutine in a heap that contiains tuples, not coroutines.
This commit is contained in:
parent
7b07f9b41e
commit
1a8919b239
|
@ -295,9 +295,11 @@ something usefull to the coroutine manager, like an ETA before calling
|
|||
if exec_at > datetime.now():
|
||||
sleep((exec_at - datetime.now()).total_seconds())
|
||||
try:
|
||||
heapq.heappush(coros, (coro.send(None), coro))
|
||||
exec_at = coro.send(None)
|
||||
except StopIteration as stop:
|
||||
coros.remove(coro)
|
||||
pass
|
||||
else:
|
||||
heapq.heappush(coros, (exec_at, coro))
|
||||
|
||||
print(measured_coro_manager(tum(), pak()))
|
||||
|
||||
|
@ -451,10 +453,12 @@ From this point we can go further by playing with the [dining philosophers probl
|
|||
if exec_at > now:
|
||||
sleep((exec_at - now).total_seconds())
|
||||
try:
|
||||
heapq.heappush(coros, (coro.send(None), i, coro))
|
||||
i += 1
|
||||
exec_at = coro.send(None)
|
||||
except StopIteration as stop:
|
||||
coros.remove(coro)
|
||||
pass
|
||||
else:
|
||||
i += 1
|
||||
heapq.heappush(coros, (exec_at, i, coro))
|
||||
|
||||
table = Table()
|
||||
measured_coro_manager(check_life(table.philosophers),
|
||||
|
|
Loading…
Reference in New Issue
Block a user