mirror of
https://github.com/autistic-symposium/web3-starter-py.git
synced 2025-05-17 22:20:22 -04:00
add some multiprocess and race condition examples
This commit is contained in:
parent
5224dc91ca
commit
be98abd3b5
4 changed files with 57 additions and 4 deletions
|
@ -8,7 +8,7 @@ import threading
|
|||
def worker(n):
|
||||
sleep = random.randrange(1, 10)
|
||||
time.sleep(sleep)
|
||||
print("Worker {}: sleeping for {} seconds.".format(n, sleep))
|
||||
print("Worker {} from {}: sleeping for {} seconds.".format(n, threading.get_ident(), sleep))
|
||||
|
||||
|
||||
for i in range(5):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue