A simple threadpool utility
Project description
SimpleThreads - A simple thread pool utility
============
A simple thread pool for python 2.x+<br/>
If you are missing ThreadPoolExecutor in python 2.x, here is a simple thread pool manager.
Import:
============
from simplethreads.ThreadPool import ThreadPool
Usage:
============
- Define tasks
def task_a():
# do something
pass
def task_b(a,b,c):
# do something more
pass
- Create a thread pool to schedule your tasks.
from simplethreads.ThreadPool import ThreadPool
# Create thread pool with nums threads
pool = ThreadPool(nums)
# Add a task into pool
pool.process(task_a)
# Pass arguments to task
pool.process(task_b,1,2,3)
# Cleanup before exit
# default value of block=True
# set to false if you dont want to wait till all the tasks are processed
# (Tasks will be processed in background though!)
pool.shutdown(block=False)
============
A simple thread pool for python 2.x+<br/>
If you are missing ThreadPoolExecutor in python 2.x, here is a simple thread pool manager.
Import:
============
from simplethreads.ThreadPool import ThreadPool
Usage:
============
- Define tasks
def task_a():
# do something
pass
def task_b(a,b,c):
# do something more
pass
- Create a thread pool to schedule your tasks.
from simplethreads.ThreadPool import ThreadPool
# Create thread pool with nums threads
pool = ThreadPool(nums)
# Add a task into pool
pool.process(task_a)
# Pass arguments to task
pool.process(task_b,1,2,3)
# Cleanup before exit
# default value of block=True
# set to false if you dont want to wait till all the tasks are processed
# (Tasks will be processed in background though!)
pool.shutdown(block=False)
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
SimpleThreads-1.0.tar.gz
(2.2 kB
view details)
File details
Details for the file SimpleThreads-1.0.tar.gz
.
File metadata
- Download URL: SimpleThreads-1.0.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4d7d233486cc98e7b433ba0571705dea6174b8b5b9cd39057593df1bc451fa7 |
|
MD5 | d81f863d0eefe3e491e9743ece5af7aa |
|
BLAKE2b-256 | 11adce9efc7b22834fe9e5560130bf3780103b98b841c35f3d32d9a8622e1668 |