mirror of
https://github.com/Relintai/programming_tutorials.git
synced 2025-05-11 22:52:11 +02:00
23 lines
321 B
Python
23 lines
321 B
Python
import threading
|
|
import time
|
|
|
|
def thread_func(threadName, delay):
|
|
print("a " + threadName)
|
|
time.sleep(delay)
|
|
print("b " + threadName)
|
|
|
|
|
|
threads = list()
|
|
for i in range(10):
|
|
x = threading.Thread(target=thread_func, args=("A", 0.25))
|
|
x.start()
|
|
|
|
threads.append(x)
|
|
|
|
for t in threads:
|
|
t.join()
|
|
|
|
|
|
|
|
|