Skip to main content

MultiThreading: Thread + Queue

Project description

Multi Threading

Example Class

import multithreading

class Demo(multithreading.MultiThread):
    def task(self, task):
        print(task)

Example Main

task_list = range(1, 3 + 1)

demo = Demo(task_list, threads=3)

# Start
demo.start()

Result

1
2
3

OR

demo = Demo(threads=3)

# Start threads
demo.start_threads()

# Adding task to queue
demo.add_task(1)
demo.add_task(2)
demo.add_task(3)

# Wait until queue is empty
demo.join()

Result

1
2
3

Install

$ pip install multithreading

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multithreading-0.1.7.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multithreading-0.1.7-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file multithreading-0.1.7.tar.gz.

File metadata

  • Download URL: multithreading-0.1.7.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for multithreading-0.1.7.tar.gz
Algorithm Hash digest
SHA256 84a21706e5bf42f05eaa8a1cb638e8dc722ee07f9a997c21bf5acc1bdb276aa0
MD5 8ce3213e73273e2774bc0cc59afba45f
BLAKE2b-256 d8ad5b91d19bf05bd4f94a52cf98a7ea212f5948170d48b588f885b40bb976b4

See more details on using hashes here.

File details

Details for the file multithreading-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: multithreading-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for multithreading-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 63f45d8eaa43d625d2040a1a1e0cbfc264a76d708ad2574befb96d801bc5d31a
MD5 bf9e1b497d3cf66a25f1e8939eca39c4
BLAKE2b-256 f254d831390236be01a819ea4bdab5829fe23773775c0e3cd94605c6c5fb5444

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page