You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- 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)
|