12.3.10.5.3. Worker thread#

This example shows how to use the Python threading package.

import threading
import time



def worker():
    """thread worker function"""
    print("worker start")
    time.sleep(2)
    print("worker end")
    return


threads = []
for i in range(5):
    t = threading.Thread(target=worker)
    threads.append(t)
    t.start()