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
Release history Release notifications | RSS feed
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.9.tar.gz
(4.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file multithreading-0.1.9.tar.gz.
File metadata
- Download URL: multithreading-0.1.9.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f4bae784984cd05a92b5abfe3bfa40ba10b614fd37d5032481b9de8b956d423
|
|
| MD5 |
3d94e3fb41b842f1d2acc8a3d919ae71
|
|
| BLAKE2b-256 |
f12f79f95f11eac3ea06ada9d1fa0c1cec0b00d9bde7a883a9235ee0a9d416bf
|
File details
Details for the file multithreading-0.1.9-py3-none-any.whl.
File metadata
- Download URL: multithreading-0.1.9-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ff3fbd25ff214df7ff4ce817f97a6aa1620da975c713be71922d9eff5e5fc2e
|
|
| MD5 |
f09cac44e600b6df2f05d8fa85b42b14
|
|
| BLAKE2b-256 |
716f099d18795f9b0c6a987d2740f8506834f41df47d148fb41a18c7ab97e247
|