All pastes #770229 Raw Edit

Mine

public python v1 · immutable
·published 2007-11-12 00:31 UTC
rendered paste body
#!/usr/bin/pythonimport threading, signal, timetrue = 0def trueAction():	global true	if true: 		true =0		print "true off"	else: 		true=1		print "true on"class MainThread( threading.Thread ):	def run( self ):		loop()			def signalHandler(signal, frame):	global true	while true:		print "waiting on true"		time.sleep(1)	print "true now off. do clean up now"	raise SystemExit, u"exiting due to exit signal %s" % signaldef loop():	while 1:		time.sleep(3)		trueAction()def main():##	MainThread().start()	loop()		if __name__ == '__main__':	signal.signal(signal.SIGINT, signalHandler)	main()