|
- import time
- from concurrent.futures import ProcessPoolExecutor
-
- a = 0
-
-
- def aa():
- global a
- # print("aaaaaaaa", a)
- time.sleep(3)
- a += 1
-
- def bb():
- global a
- print(a)
-
- if __name__ == "__main__":
- with ProcessPoolExecutor(max_workers=3) as t:
- t.submit(aa)
- t.submit(bb)
- t.submit(aa)
- t.submit(bb)
- t.submit(aa)
- t.submit(bb)
- t.submit(aa)
- t.submit(bb)
- t.submit(aa)
- t.submit(bb)
- t.submit(aa)
- t.submit(bb)
- t.submit(aa)
- t.submit(bb)
- t.submit(aa)
|