https://github.com/aztecrabbit/multithreading
Thread + Queue
https://github.com/aztecrabbit/multithreading
concurrency hacktoberfest python queue thread threading
Last synced: 6 months ago
JSON representation
Thread + Queue
- Host: GitHub
- URL: https://github.com/aztecrabbit/multithreading
- Owner: aztecrabbit
- License: mit
- Created: 2020-08-05T16:36:37.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-07T15:56:02.000Z (over 5 years ago)
- Last Synced: 2025-10-27T12:22:25.370Z (9 months ago)
- Topics: concurrency, hacktoberfest, python, queue, thread, threading
- Language: Python
- Homepage:
- Size: 62.5 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Multi Threading
Example Class
-------------
```python
import multithreading
class Demo(multithreading.MultiThread):
def task(self, task):
print(task)
```
Example Main
------------
```python
task_list = range(1, 3 + 1)
demo = Demo(task_list, threads=3)
# Start
demo.start()
```
Result
```
1
2
3
```
**OR**
```python
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
-------
```shell
$ pip install multithreading
```