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

Class ThreadPoolMixIn

source code

Known Subclasses:
ThreadPool, ThreadPoolShared

Instance Methods [hide private]
 
_init_(self, maxthreads, can_grow) source code
 
begin(self, cnt=None)
Begin a synchronous block.
source code
 
close(self) source code
 
end(self)
Wait to finish all the threads in this pool, since the self.begin call
source code
 
execute(self, endfunction, function, *args, **argd)
Execute |function| into a diferent thread with args (positional arguments) and argd (named arguments).
source code
 
put_block(self, obj)
Returns the thread |obj| to the pool, internal method
source code
Method Details [hide private]

begin(self, cnt=None)

source code 
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

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

source code 
Execute |function| into a diferent thread with args (positional
arguments) and argd (named arguments).
If |endfunction| is diferent of None:
   If it is callable: It's 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. 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