A simple module for creating a background thread and returning a Future object
Project description
Creates a thread with Future attributes.
Based on (and actively uses) features from concurrent.futures module to easily start a function in a new background thread without the overhead of using a ThreadPoolExecutor, while still providing a Future style handle around said thread.
Usage:
import time from future_thread import Future, DeferredFuture def background(): time.sleep(10) return True fut = Future(background) fut.result() # will block until thread finished fut = DeferredFuture(background) # do some other stuff fut.start()
For more info on the Future object see: https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file future_thread-1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: future_thread-1.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b56d570e946b23aa40792904f8219e9aa92ed8096a36f79ff0c2d4a2a5b559b |
|
MD5 | 90fcaa11f91fda0629eec8082db72833 |
|
BLAKE2b-256 | 8236abe0a9268c28b4671a4bc79b6c23a063720ded76197246cc697d084eebea |