Package threadutils :: Module ThreadPool :: Class ThreadPoolMixIn
[show private | hide private]
[frames | no frames]

Class ThreadPoolMixIn

Known Subclasses:
ThreadPool, ThreadPoolShared

Method Summary
  _init_(self, maxthreads, can_grow)
  begin(self, cnt)
Begin a synchronous block.
  close(self)
  end(self)
Wait to finish all the threads in this pool, since the self.begin call
  execute(self, endfunction, function, *args, **argd)
Execute |function| into a diferent thread with args (positional arguments) and argd (named arguments).
  put_block(self, obj)
Returns the obj thread to the pool, intern method

Method Details

begin(self, cnt=None)

Begin a synchronous block. Block's inside |cnt| threads are executed, but the program control will wait it in the block (in the self.end call). If |cnt| is not present, self.maxthreads is used

end(self)

Wait to finish all the threads in this pool, since the self.begin call

execute(self, endfunction, function, *args, **argd)

Execute |function| into a diferent thread with args (positional
arguments) and argd (named arguments).
If |endfunction| is diferent of None:
   If it is callable: is called with is called with two arguments. The
   first argument is the result, the second is the
   exceptionCatched (if any).
   In other words: endfunction(res, exc)
   
   If |endfunction| is not callable: the first item is called as a
   function and |endfunction| is passed as third argument. The first
   two arguments are equal to the previous case.
   In other words: endfunction[0](res, exc, endfunction)
|result| is
the result value of calling |function|, and |exceptionCatched| is not
None if an exception was catched while |function| was running

put_block(self, obj)

Returns the obj thread to the pool, intern method

Generated by Epydoc 2.1 on Sat Oct 14 11:50:52 2006 http://epydoc.sf.net