| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
| 13 |
| 14 |
| 15 |
| 16 |
| 17 |
| 18 |
| 19 |
| 20 |
| 21 |
| 22 |
| 23 |
| 24 |
| 25 |
| 26 |
| 27 |
| 28 |
| 29 |
| 30 |
| 31 | |
def test_some(): |
pool = WorkerPool() |
q = py.std.Queue.Queue() |
num = 4 |
|
def f(i): |
q.put(i) |
while q.qsize(): |
py.std.time.sleep(0.01) |
for i in range(num): |
pool.dispatch(f, i) |
for i in range(num): |
q.get() |
assert len(pool._alive) == 4 |
-> pool.shutdown() |
|
|
|
|
|
|
py.std.time.sleep(1) |
assert len(pool._alive) == 0 |
assert len(pool._ready) == 0 | |