Skip to main content

A package that provides extended control over threads

Project description

Better Threads

Ever wanted to pause, stop, resume or pipe data between threads? Well this module does exactly that.

Key features

  • Pipe data between threads
  • Pause, Resume and Stop threads
  • Simple

Installing

Python 3.7 or higher is required

pip install better-threads

Quick example

More exmples https://github.com/ItsYasiru/Better-Threads/tree/master/examples

import time
from BetterThreads import ThreadPool

thread_pool = ThreadPool()


@thread_pool.thread()
def test_loop():
    print("Loop running!")
    time.sleep(1)


thread_pool.start(test_loop)
time.sleep(5)
thread_pool.pause(test_loop)
time.sleep(5)
thread_pool.resume(test_loop)
time.sleep(5)
thread_pool.terminate(test_loop)

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

better-threads-2.0.0.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

better_threads-2.0.0-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

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