Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

wtmmac/ThreadPool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Thread pool

This is a simple thread pool for python(using queue module).

Install:

    python setup.py install

Usage:

  • Firstly, you should define a callback to deal with your task.

      def do_work(*args, **kwds):
          # do something
    
  • Then, you can create a thread pool to schedule your tasks.

      from threadpool import ThreadPool
      # Create thread pool with nums threads
      pool = ThreadPool(nums)
      # Add a task into pool
      pool.add_task(do_work, args, kwds)
      # Join and destroy all threads
      pool.destroy()
    

About

A simple thread pool for python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published