.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\python_packages\parallelization_threading\demoworkerThread.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_11_demos_python_packages_parallelization_threading_demoworkerThread.py: Worker thread ================ This example shows how to use the Python ``threading`` package. .. GENERATED FROM PYTHON SOURCE LINES 6-24 .. code-block:: default 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() .. _sphx_glr_download_11_demos_python_packages_parallelization_threading_demoworkerThread.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demoworkerThread.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demoworkerThread.ipynb `