| 1 |
# Threading.current_thread does not change when using greenthreads? |
| 2 |
# https://github.com/eventlet/eventlet/issues/172 |
| 3 |
__test__ = False |
| 4 |
|
| 5 |
if __name__ == '__main__': |
| 6 |
import eventlet |
| 7 |
eventlet.monkey_patch() |
| 8 |
|
| 9 |
import threading |
| 10 |
|
| 11 |
g = set() |
| 12 |
|
| 13 |
def fun(): |
| 14 |
ct = threading.current_thread() |
| 15 |
g.add(ct.name) |
| 16 |
|
| 17 |
ts = tuple(threading.Thread(target=fun, name='t{}'.format(i)) for i in range(3)) |
| 18 |
for t in ts: |
| 19 |
t.start() |
| 20 |
for t in ts: |
| 21 |
t.join() |
| 22 |
|
| 23 |
assert g == {'t0', 't1', 't2'}, repr(g) |
| 24 |
|
| 25 |
print('pass') |