Takes the hassle away from threading functions and getting their results
Project description
Python Threadit
Running functions in threads with no effort
A nice package to help you run functions in threads and get their result.
Installation
pip install threadit
Usage
from threadit import Threadit
def get_company_name():
# Do work in thread
return 'Adapted'
def do_some_work():
get_name = Threadit(get_company_name)
# do stuff or run a while loop to wait for result
more_thread = Threadit(get_company_name)
while get_name.doing_working():
print('Waiting for thread to finnish')
# You can also call .result() and the main thread will wait for the thread to return your result.
company_name = get_name.result()
company_name2 = more_thread.result()
print(company_name) # Outputs -> Adapted
print(company_name2) # Outputs -> Adapted
Testing
Use the following command to run tests.
python -m unittest threadit.tests.test_threadit
Changelog:
See CHANGELOG.md
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
threadit-1.0.0.tar.gz
(2.3 kB
view hashes)