comparison py/sensor_ds18b20.py @ 518:0b5ff341d124

sleep on a semaphore so it can start/stop immediately when there's a SIGHUP from the web UI. makes it seem more magical.
author Matt Johnston <matt@ucc.asn.au>
date Fri, 19 Dec 2014 21:52:50 +0800
parents d05b1612e19e
children d9e81a563923
comparison
equal deleted inserted replaced
517:c399293de160 518:0b5ff341d124
33 self.server.add_reading(vals) 33 self.server.add_reading(vals)
34 34
35 def _run(self): 35 def _run(self):
36 while True: 36 while True:
37 self.do() 37 self.do()
38 gevent.sleep(config.SENSOR_SLEEP) 38 self.server.sleep(config.SENSOR_SLEEP)
39 39
40 def read_wait(self, f): 40 def read_wait(self, f):
41 # handles a blocking file read with a gevent threadpool. A 41 # handles a blocking file read with a gevent threadpool. A
42 # real python thread performs the read while other gevent 42 # real python thread performs the read while other gevent
43 # greenlets keep running. 43 # greenlets keep running.