mirror of
https://github.com/autistic-symposium/web3-starter-py.git
synced 2025-05-17 22:20:22 -04:00
add all concurrence examples
This commit is contained in:
parent
2333b724ec
commit
5224dc91ca
12 changed files with 49 additions and 2 deletions
10
Concurrence_examples/pool_example.py
Normal file
10
Concurrence_examples/pool_example.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from multiprocessing import Pool
|
||||
|
||||
def f(x):
|
||||
return x*x
|
||||
|
||||
if __name__ == '__main__':
|
||||
p = Pool(5)
|
||||
print(p.map(f, [1, 2, 3]))
|
Loading…
Add table
Add a link
Reference in a new issue