Abstract base class for objects that munch data on one end and act like iterators to yield it on the other end.

See AlsoConsumerator and Filerator.
Class IterationStopper Undocumented
Method __init__ IterationGetter(maxThreads=None)
Method start Call this when I should start listening for iterations.
Method loop Override this method to generate a value for my iterations. The method must be synchronized with a series of locking primitives:
Method deferUntilDone Returns a Deferred that fires when I am done iterating.
Method __iter__ Undocumented
Method __next__ Undocumented

Inherited from PoolUser:

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.
def __init__(self, maxThreads=None):

IterationGetter(maxThreads=None)

def start(self):

Call this when I should start listening for iterations.

Sets up locks for my iteration-consuming thread (from my ThreadPool), the blocking-iterator thread, and the next-iteration event. Lock both of my iteration-processing loops until an iteration is received, but leaves the next-iteration lock nLock unlocked. The iteration-consuming thread will lock it to overwrite the blocking-iterator thread's value of each iteration.

Calls my subclass's loop method in its own thread. If too many threads are currently open, queues the loop call until one finishes up in some other instance of me.

def loop(self):

Override this method to generate a value for my iterations. The method must be synchronized with a series of locking primitives:

  1. First, wait to acquire cLock. This will be released when a value has been given to my subclass instance, e.g., through its write method. At this point, you can retrieve the value and let your value provider know it is free to provide more.
  2. Then wait to acquire nLock. This will be released when the next method has obtained its next iteration value from bIterationValue. At this point, overwrite bIterationValue with the new value you've just obtained, or with an instance of IterationStopper if iteration is done.
  3. Release bLock to let the next loop know it can process the next iteration value (or iteration stopper) now in bIterationValue.
See AlsoConsumerator.loop and Filerator.loop
def deferUntilDone(self):

Returns a Deferred that fires when I am done iterating.

def __iter__(self):
Undocumented
def __next__(self):
Undocumented
API Documentation for AsynQueue, generated by pydoctor at 2022-11-17 13:13:24.