🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

multithreading

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multithreading

MultiThreading: Thread + Queue

0.2.0
PyPI
Maintainers
1

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

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts