本文整理汇总了Python中threading.Thread.release方法的典型用法代码示例。如果您正苦于以下问题:Python Thread.release方法的具体用法?Python Thread.release怎么用?Python Thread.release使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类threading.Thread
的用法示例。
在下文中一共展示了Thread.release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HumidityReader
# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import release [as 别名]
class HumidityReader(object):
'''
classdocs
'''
__metaclass__ = abc.ABCMeta
def __init__(self, sensorName="DHT11Humididty"):
'''
Constructor
'''
#dht11 = HumididtySensorFactory.createSensor(sensorName)
self.sensor = Sensor()
self.threadSensor = Thread(target = self.measureHumidity, args=(self.sensor,5))
self.threadSensor.daemon = True
def startThread(self):
print "inside startThread"
self.threadSensor.start()
def pauseThread(self):
print "inside pauseThread"
#self.threadSensor.
def releaseThread(self):
print "inside releaseThread"
self.threadSensor.release()
def measureHumidity(self,sensor, delay):
try:
while (True) :
self.sensor.getHumidity() #salvar aqui no banco a leitura
time.sleep(delay)
except (KeyboardInterrupt, SystemExit):
raise
except:
print "saindo da thread"