[PEAK] subscribable/conditional lists
John Landahl
john at landahl.org
Tue Apr 20 19:22:59 EDT 2004
peak.events could use support for subscribable/conditional lists, which
could be used as an input queue for a Task-based worker loop. Something
like the following:
class Work(binding.Component):
queue = binding.Make(ConditionalList)
def worker(self):
while True:
yield self.queue; queue = events.resume()
while queue:
doWork(queue.pop(0))
worker = binding.Make(events.taskFactory(worker), uponAssembly=True)
def addWork(self, data):
self.queue.append(data)
The worker should suspend until there's work for it in the queue, at
which point it consumes the data in the queue and waits for more work.
I've come up with a basic implementation (attached); does seem like a
decent approach, or is there a better way to do this?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eventlist.py
Type: text/x-python
Size: 3314 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20040420/f5398c02/eventlist.py
More information about the PEAK
mailing list