| Tor Norbye | 1aa2e09 | 2014-08-20 17:01:23 -0700 | [diff] [blame^] | 1 | try: |
| 2 | import thread | ||||
| 3 | except : | ||||
| 4 | import _thread as thread | ||||
| 5 | |||||
| 6 | import threading | ||||
| 7 | |||||
| 8 | def bar(y): | ||||
| 9 | z = 100 + y | ||||
| 10 | print("Z=%d"%z) | ||||
| 11 | |||||
| 12 | def foo(x): | ||||
| 13 | y = x + 1 | ||||
| 14 | print("Y=%d"%y) | ||||
| 15 | |||||
| 16 | t = threading.Thread(target=bar, args=(y,)) | ||||
| 17 | t.start() | ||||
| 18 | |||||
| 19 | |||||
| 20 | id = thread.start_new_thread(foo, (1,)) | ||||
| 21 | |||||
| 22 | while True: | ||||
| 23 | pass | ||||
| 24 | |||||