asynqueue.threads.PoolUser(object) class documentation
asynqueue.threads(View In Hierarchy)
Abstract base class for objects that access a global thread pool instead of starting their own threads.
|Class Method||setup||Sets up stuff class-wide, with all the potential pitfalls that entails.|
|Class Method||shutdown||Shuts down all threads, returning a
|Class Method||deferToThreadInPool||Runs the
|Method||pool||Returns a reference to the class-wide threadpool, starting it if this is the first time it's been used.|
def setup(cls, maxThreads=None):
Sets up stuff class-wide, with all the potential pitfalls that entails.
If this method is called with a thread pool already instantiated, and maxThreads is specified and different from the current value, it adjusts the maximum thread pool size for all instances, current and future, absent yet another call with still different values.
|Parameters||maxThreads||Set to a maximum number of threads to use, for all present and future instances.|
|Note||In the several years that have gone by since I wrote this, I realized that it's almost always a terrible idea to make class-wide settings of anything. But it's mature code and hasn't given me any trouble.|
Shuts down all threads, returning a
Deferred that fires
when everything's done, class-wide.
def deferToThreadInPool(cls, f, *args, **kw):
f-args-kw call combo in one of my threads,
Deferred that fires with the eventual result. Can
be run from the class or any instance of me with the exact same result.