def timer(t, flag):
global FLAG_COMPLETE
global TIME_OVER_FLAG
if (not flag):
thread.exit()
start = time.time()
while(True):
if(FLAG_COMPLETE):
thread.exit()
time.sleep(5)
# print "#######\ntime.time() - start %f : t is %d" %(time.time() -
# start,(int)(t))
if(time.time() - start > float(t)):
print "****timer:time out!"
# if(FLAG_COMPLETE):
# thread.exit()
TIME_OVER_FLAG = True
thread.interrupt_main()
#raise NameError("Time Out!")
thread.exit()
评论列表
文章目录