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 Deferred that fires when everything's done, class-wide.
Class Method deferToThreadInPool Runs the f-args-kw call combo in one of my threads, returning a Deferred that fires with the eventual result. Can be run from the class or any instance of me with the exact same result.
Method pool Returns a reference to the class-wide threadpool, starting it if this is the first time it's been used.
@classmethod
def setup(cls, maxThreads=None):

Sets up stuff class-wide, with all the potential pitfalls that entails.

Sets up all present and future instances of Consumerator, Filerator, OrderedItemProducer, and any other subclasses of me with a thread pool having at least two and no more than maxThreads threads.

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.

ParametersmaxThreadsSet to a maximum number of threads to use, for all present and future instances.
NoteIn 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.
@classmethod
def shutdown(cls):

Shuts down all threads, returning a Deferred that fires when everything's done, class-wide.

@classmethod
def deferToThreadInPool(cls, f, *args, **kw):

Runs the f-args-kw call combo in one of my threads, returning a Deferred that fires with the eventual result. Can be run from the class or any instance of me with the exact same result.

@property
def pool(self):

Returns a reference to the class-wide threadpool, starting it if this is the first time it's been used.

API Documentation for AsynQueue, generated by pydoctor at 2022-11-17 13:13:24.