asynqueue.threads.IterationGetter(PoolUser) class documentation
asynqueue.threads(View In Hierarchy)
|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:|
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
|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.|
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
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.
Override this method to generate a value for my iterations. The method must be synchronized with a series of locking primitives:
First, wait to acquire cLock. This will be released when a value
has been given to my subclass instance, e.g., through its
writemethod. At this point, you can retrieve the value and let your value provider know it is free to provide more.
Then wait to acquire nLock. This will be released when the
nextmethod 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
IterationStopperif iteration is done.
Release bLock to let the
nextloop know it can process the next iteration value (or iteration stopper) now in bIterationValue.