aboutsummaryrefslogtreecommitdiff
path: root/driverdemo.py
blob: 1c359b56d1d7830e2f830832c7f2463fa83888a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from drivers import *
from threading import * 
import Queue
class TestProcessor(Processor):
  def do(self):
    data = []
    if not self.input_queue.empty():
      data.append(self.input_queue.get(False))
    self.again(.1)
    self.done(data)

class TestListener(Listener):
  def handle(self, data):
    print data
    print active_count()

def addToQueue():
  queue.put("test")
  again = Timer(.5, addToQueue)
  again.start()

queue = Queue.Queue()
t = TestProcessor(queue)
l = TestListener()
t.listeners.append(l)
queue = t.input_queue
t.do()
addToQueue()